Fix: Use configured relationship emojis from tracker config instead of hardcoded defaults

- Load relationshipEmojis from config.relationshipEmojis in thoughts.js
- Custom relationships added in Edit Trackers now display correctly as emojis
- Falls back to default emojis if config not available
This commit is contained in:
Spicy_Marinara
2025-11-06 09:37:41 +01:00
parent d8707318c8
commit fe69a15a48
2 changed files with 15 additions and 4 deletions
+11 -2
View File
@@ -215,8 +215,8 @@ export function renderThoughts() {
}
}
// Relationship status to emoji mapping (for backward compatibility with old "relationship" field)
const relationshipEmojis = {
// Get relationship emojis from config (with fallback defaults)
const relationshipEmojis = config?.relationshipEmojis || {
'Enemy': '⚔️',
'Neutral': '⚖️',
'Friend': '⭐',
@@ -498,6 +498,10 @@ export function updateCharacterField(characterName, field, value) {
let statsLineExists = false;
let statsLineIndex = -1;
// Get the configured thoughts field name
const thoughtsFieldName = presentCharsConfig?.thoughts?.name || 'Thoughts';
const isThoughtsField = field.toLowerCase() === 'thoughts' || field === thoughtsFieldName;
// First pass: check if Stats line exists and update other fields
for (let i = characterStartIndex; i < characterEndIndex; i++) {
const line = lines[i].trim();
@@ -530,6 +534,11 @@ export function updateCharacterField(characterName, field, value) {
const relationshipValue = emojiToRelationship[value] || value;
lines[i] = `Relationship: ${relationshipValue}`;
}
else if (isThoughtsField && line.startsWith(thoughtsFieldName + ':')) {
// Update thoughts field
lines[i] = `${thoughtsFieldName}: ${value}`;
console.log('[RPG Companion] Updated thoughts:', lines[i]);
}
}
// Handle stat updates