30d6f71fc7
- Fix TypeError: controls.find is not a function in hooks.mjs - Fix undefined 'npc' variable in applications.mjs - Fix CONFIG.VERMINE.model undefined by checking game.system.template existence - Fix TypeError: html.find(...).forEach is not a function in roll.mjs - Fix Cannot set properties of undefined (setting 'initial') in actor.mjs - Fix Cannot read properties of undefined (reading 'difficulty') in actor.mjs - Fix ActiveEffect application phase 'initial' already completed by adding combatStatus to base template - Fix Missing helper: 'select' in roll-dialog.hbs (removed invalid Handlebars select block) - Add SIZE_LEVELS labels to creatureSizeLevels config - Add SIZE_LEVELS translations to fr.json - Add combatStatus to base actor template - Convert all .html templates to .hbs for Foundry v14 compatibility - Update item-sheet.mjs to use .hbs extension - Update handlebars-manager.mjs to use .hbs for all partials Complete Vermine2047 Creature and Group sheet implementation: - Creature: Pattern, Size, Role, Pack with computed values - Group: Totem, Reserve, Morale, Objectives, Members management - All templates functional with proper styling Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
125 lines
3.7 KiB
JavaScript
125 lines
3.7 KiB
JavaScript
import { registerHooks } from "./system/hooks.mjs";
|
|
import { registerSettings } from "./system/settings.mjs";
|
|
import { GroupLink } from "./system/group-link.mjs";
|
|
|
|
// Import document classes.
|
|
import { VermineActor } from "./documents/actor.mjs";
|
|
|
|
import { VermineCharacterSheet } from "./sheets/character-sheet.mjs";
|
|
import { VermineNpcSheet } from "./sheets/npc-sheet.mjs";
|
|
import { VermineGroupSheet } from "./sheets/npc-group.mjs";
|
|
import { VermineCreatureSheet } from "./sheets/creature-sheet.mjs";
|
|
|
|
import { VermineItem } from "./documents/item.mjs";
|
|
import { VermineItemSheet } from "./sheets/item-sheet.mjs";
|
|
|
|
import { VermineUtils } from "./system/roll.mjs";
|
|
import { VermineCombat, VermineCombatant, VermineCombatTracker } from "./system/fight.mjs";
|
|
|
|
// Import helper/utility classes and constants.
|
|
import { preloadHandlebarsTemplates, registerHandlebarsHelpers } from "./system/handlebars-manager.mjs";
|
|
import { VERMINE } from "./system/config.mjs";
|
|
|
|
/* -------------------------------------------- */
|
|
/* Init Hook */
|
|
/* -------------------------------------------- */
|
|
|
|
Hooks.once('init', async function () {
|
|
|
|
// Add utility classes to the global game object so that they're more easily
|
|
// accessible in global contexts.
|
|
game.vermine2047 = {
|
|
VermineActor,
|
|
VermineItem,
|
|
VermineUtils,
|
|
VermineCombat,
|
|
GroupLink
|
|
};
|
|
|
|
// Register GroupLink hooks for automatic synchronization
|
|
GroupLink.registerHooks();
|
|
|
|
// Define custom Document classes
|
|
CONFIG.Actor.documentClass = VermineActor;
|
|
CONFIG.Item.documentClass = VermineItem;
|
|
|
|
CONFIG.ui.combat = VermineCombatTracker;
|
|
CONFIG.Combatant.documentClass = VermineCombatant;
|
|
CONFIG.Combat.documentClass = VermineCombat;
|
|
|
|
|
|
// Register sheet application classes
|
|
Actors.unregisterSheet("core", ActorSheet);
|
|
Actors.registerSheet('vermine2047', VermineCharacterSheet, {
|
|
types: ['character'],
|
|
makeDefault: true,
|
|
});
|
|
|
|
Actors.registerSheet('vermine2047', VermineNpcSheet, {
|
|
types: ['npc'],
|
|
makeDefault: true,
|
|
});
|
|
|
|
Actors.registerSheet('vermine2047', VermineCreatureSheet, {
|
|
types: ['creature'],
|
|
makeDefault: true,
|
|
});
|
|
|
|
Actors.registerSheet('vermine2047', VermineGroupSheet, {
|
|
types: ['group'],
|
|
makeDefault: true,
|
|
});
|
|
Items.unregisterSheet("core", ItemSheet);
|
|
Items.registerSheet("vermine2047", VermineItemSheet, { makeDefault: true });
|
|
|
|
registerHandlebarsHelpers(); // Register Handlebars helpers
|
|
registerHooks(); // register Hooks
|
|
registerSettings(); // register Vermine Settings
|
|
|
|
// Add custom constants for configuration.
|
|
CONFIG.VERMINE = VERMINE;
|
|
|
|
// Set up model templates - must be done after system templates are loaded
|
|
if (game.system?.template?.Actor && game.system?.template?.Item) {
|
|
CONFIG.VERMINE.model = {
|
|
Actor: game.system.template.Actor,
|
|
Item: game.system.template.Item
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Set an initiative formula for the system
|
|
* @type {String}
|
|
*/
|
|
CONFIG.Combat.initiative = {
|
|
formula: "(@abilities.reflexes.value + @skills.alertness.value)d10cs>=@combatStatus.difficulty",
|
|
decimals: 2
|
|
};
|
|
|
|
//afficher le mode de jeu
|
|
let mode = game.settings.get('vermine2047', 'game-mode');
|
|
if (!mode) { mode = '1'; await game.settings.set('vermine2047', 'game-mode', '1') }
|
|
let el = document.createElement('SPAN');
|
|
switch (mode) {
|
|
case '1':
|
|
el.innerText = 'mode survie';
|
|
break;
|
|
case '2':
|
|
el.innerText = 'mode cauchemard';
|
|
break;
|
|
case '3':
|
|
el.innerText = 'mode apocalypse';
|
|
break;
|
|
}
|
|
el.classList.add('game-mode');
|
|
el.id = 'game-mode-' + mode;
|
|
document.querySelector('#ui-left').prepend(el);
|
|
|
|
|
|
// Preload Handlebars templates.
|
|
return preloadHandlebarsTemplates();
|
|
|
|
});
|
|
|
|
|