jessev14 / dnd5e-character-monitor

FVTT module that monitors character sheet changes and logs them in chat.
MIT License
0 stars 10 forks source link

Toggling Edit Button Spams Messages #39

Open Squirrelydood opened 2 months ago

Squirrelydood commented 2 months ago

When toggling the Edit button on a character sheet it causes the module to spam chat with messages once it's switched back or the sheet is closed and the changes saved. This only seems to apply to Ability Scores and Skills, and disabling those options will stop the messages. It does this even when no changes were made to Ability Scores or Skills, I assume it simply just reads it as being edited even if no new information was put in.

davidR1974 commented 3 weeks ago

maybe due to how changes are passed in the preUpdateActor...

can be modified :

look for section in dnd5e-character-monitor.js and add the last line in the code below (for proficiencies) :

            // Proficiency changes
            if (game.settings.get(moduleName, "monitorProficiency") && ("skills" in (data.system || {}))) {

                for (const [skl, changes] of Object.entries(data.system.skills)) {

                    if (!("value" in changes)) continue;
                    if (typeof changes.value !== "number") continue;
                    if ( changes.value == actor.system.skills[skl].value) continue;

and for abilities :

            // Ability changes
            if (game.settings.get(moduleName, "monitorAbility") && ("abilities" in (data.system || {}))) {
                for (const [abl, changes] of Object.entries(data.system.abilities)) {
                    if (!("value" in changes)) continue;
                    if (typeof changes.value !== "number") continue;
                    if ( changes.value == actor.system.abilities[abl].value) continue;