feat: rpg stats improvements

This commit is contained in:
Subarashimo
2025-12-04 20:40:02 +01:00
parent b5f5f6d9c5
commit 9f6c44745b
9 changed files with 310 additions and 98 deletions
+16
View File
@@ -43,6 +43,12 @@
* Example: { "Health": 85, "Energy": 70, "Custom Stat": 50 }
*/
/**
* @typedef {Object.<string, number>} TrackerAttributes
* Dynamic attributes object - keys are attribute names from config (e.g., STR, DEX), values are numeric
* Example: { "STR": 15, "DEX": 12, "INT": 18 }
*/
/**
* @typedef {Object} TrackerStatus
* @property {string} [mood] - Mood emoji (if enabled)
@@ -84,6 +90,8 @@
* @typedef {Object} TrackerData
* @property {TrackerStats} [stats] - Numeric stats (based on config)
* @property {TrackerStatus} [status] - Status info (mood, custom fields)
* @property {TrackerAttributes} [attributes] - RPG attributes (STR, DEX, etc.)
* @property {number} [level] - Character level
* @property {TrackerInfoBox} [infoBox] - Scene information (based on enabled widgets)
* @property {TrackerCharacter[]} [characters] - Present characters
* @property {TrackerInventory} [inventory] - Player inventory
@@ -431,6 +439,14 @@ export function mergeTrackerData(existing, newData) {
};
}
if (newData.attributes) {
merged.attributes = { ...merged.attributes, ...newData.attributes };
}
if (newData.level !== undefined) {
merged.level = newData.level;
}
if (newData.infoBox) {
merged.infoBox = { ...merged.infoBox, ...newData.infoBox };
}