Caraxi / SimpleHeels

FFXIV plugin for adjusting the position of characters when wearing modded footwear.
21 stars 10 forks source link

Dragging Emote Offsets doesn't update IPC in real-time #32

Closed helpful-fox-senko-san closed 7 months ago

helpful-fox-senko-san commented 7 months ago

Hi. Dragging the Emote Offsets sliders is no longer updating IPC in real-time.

I believe this is because EmoteConfig is a referential data type, so when the IPC payload is compared to ApiProvider._lastReported, they will compare equal and not send the IPC:

            var data = new IpcCharacterConfig(_plugin, gameObject);
            if (data.Equals(_lastReported)) return; // <--
            // ...
            _lastReported = data;

Here, a reference is made to the local player's EmoteConfig, because a deep clone of List<EmoteConfig> is not done:

    public IpcCharacterConfig(Plugin plugin, PlayerCharacter player) {
        // ...
            EmoteConfigs = characterConfig?.EmoteConfigs?.Where(e => e.Enabled).ToList() ?? new List<EmoteConfig>();  // <--
        // ...
    }

This bug was probably triggered by the removal of legacy IPC data, which might have been disambiguating the JSON objects before.

One solution that fixes this is to change _lastReported to a string instead of an IpcCharacterConfig.

Caraxi commented 7 months ago

The equals function of IpcCharacterConfig compares it as a json string already (as inefficient as that is) nevermind I see what you mean

I'll look into it

Caraxi commented 7 months ago

Should be fixed with 0.9.0.8