Add customizable RPG attributes and fix character stats editing

Features:
- Made RPG attributes (STR/DEX/CON/INT/WIS/CHA) fully customizable
- Added enable/disable toggle for entire RPG Attributes section
- Users can add/remove/rename/toggle individual attributes
- Custom attribute names now appear in AI prompts for dice rolls
- Added proper CSS styling for attribute editor fields

Bug Fixes:
- Fixed character stat editing showing 0% on blur but saving correctly
- Character stats now create Stats line if missing from AI response
- Separated stat name from editable percentage value
- Added value sanitization (removes %, validates 0-100 range)
- Stats line now inserts before Thoughts line when created

Technical:
- Added buildAttributesString() helper in promptBuilder.js
- Updated generateTrackerInstructions and generateContextualSummary
- Restructured character stat HTML to prevent nested contenteditable
- Enhanced updateCharacterField to handle missing Stats lines
- Removed legacy default preset/regex import code
This commit is contained in:
Spicy_Marinara
2025-11-03 17:01:53 +01:00
parent f20710f5a3
commit d8707318c8
10 changed files with 218 additions and 143 deletions
-11
View File
@@ -118,9 +118,6 @@ import { ensureHtmlCleaningRegex, detectConflictingRegexScripts } from './src/sy
import { setupMemoryRecollectionButton, updateMemoryRecollectionButton } from './src/systems/features/memoryRecollection.js';
import { initLorebookLimiter } from './src/systems/features/lorebookLimiter.js';
// Utility modules
import { importAllDefaults } from './src/utils/importDefaults.js';
// Integration modules
import {
commitTrackerData,
@@ -604,14 +601,6 @@ jQuery(async () => {
// Non-critical - continue anyway
}
// Import default preset and regexes if user doesn't have them
try {
await importAllDefaults();
} catch (error) {
console.error('[RPG Companion] Failed to import defaults:', error);
// Non-critical - continue anyway
}
// Register all event listeners
try {
registerAllEvents({