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
+30
View File
@@ -3682,6 +3682,36 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
opacity: 0.8;
}
/* RPG Attributes editor styles (same as custom stats) */
.rpg-attr-toggle {
flex-shrink: 0;
}
.rpg-attr-name {
flex: 1;
padding: 0.375em 0.5em;
background: var(--rpg-bg);
border: 1px solid var(--rpg-border);
border-radius: 0.25em;
color: var(--rpg-text);
font-size: 0.95em;
}
.rpg-attr-remove {
flex-shrink: 0;
padding: 0.375em 0.625em;
background: var(--rpg-highlight);
border: none;
border-radius: 0.25em;
color: white;
cursor: pointer;
transition: opacity 0.2s;
}
.rpg-attr-remove:hover {
opacity: 0.8;
}
/* Toggle rows */
.rpg-editor-toggle-row {
display: flex;