fix: Correct critical bugs and complete Creature/Group DataModel implementation

- 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>
This commit is contained in:
2026-06-04 20:58:22 +02:00
parent f9f07cbc7e
commit 30d6f71fc7
43 changed files with 19225 additions and 609 deletions
+52 -9
View File
@@ -12,9 +12,9 @@ export class VermineCreatureSheet extends VermineActorSheet {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor", "creature"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 300,
height: 300,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
width: 650,
height: 600,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }]
});
}
@@ -52,6 +52,12 @@ export class VermineCreatureSheet extends VermineActorSheet {
this._prepareItems(context);
}
// Prepare Creature data and items.
if (actorData.type == 'creature') {
this._prepareItems(context);
this._prepareCreatureData(context);
}
// Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData();
@@ -68,6 +74,18 @@ export class VermineCreatureSheet extends VermineActorSheet {
*
* @return {undefined}
*/
_prepareItems(context) {
context.gear = this.actor.itemTypes['item'];
context.traits = this.actor.itemTypes['trait'];
}
/**
* Prepare Character type specific data.
*
* @param {Object} actorData The actor to prepare.
*
* @return {undefined}
*/
_prepareCharacterData(context) {
// Handle ability scores.
for (let [k, v] of Object.entries(context.system.abilities)) {
@@ -76,15 +94,40 @@ export class VermineCreatureSheet extends VermineActorSheet {
}
/**
* Organize and classify Items for Character sheets.
*
* @param {Object} actorData The actor to prepare.
* Prepare Creature type specific data for the sheet.
*
* @param {Object} context The context data to prepare.
* @return {undefined}
*/
_prepareItems(context) {
context.gear = this.actor.itemTypes['item'];
context.traits = this.actor.itemTypes['trait'];
_prepareCreatureData(context) {
if (this.actor.type !== 'creature') return;
// Add computed values to context
context.computed = context.system.computed || {};
// Get labels for pattern, size, role
const patternLevel = context.system.pattern?.value || 1;
const sizeLevel = context.system.size?.value || 1;
const roleLevel = context.system.role?.value || 1;
const packLevel = context.system.pack?.value || 0;
// Add pattern label
const patternConfig = CONFIG.VERMINE.creaturePatternLevels[patternLevel];
if (patternConfig) {
context.patternLabel = game.i18n.localize(patternConfig.label);
}
// Add size label (using numeric for now)
context.sizeLabel = sizeLevel;
// Add role label
const roleConfig = CONFIG.VERMINE.creatureRoleLevels[roleLevel];
if (roleConfig) {
context.roleLabel = game.i18n.localize(roleConfig.label);
}
// Add pack label
context.packLabel = packLevel > 0 ? packLevel : game.i18n.localize('VERMINE.none');
}
/* -------------------------------------------- */