SlashNephy / Divination

FINAL FANTASY XIV toolkits
http://xiv.starry.blue/
MIT License
19 stars 6 forks source link

[FaloopIntegration] Fix ActiveMobUi death function not being called. #670

Closed Diyagi closed 2 months ago

Diyagi commented 2 months ago

Fix #669 The function to remove the report from the ActiveMobUi was behind the check for Enable Mob Death Report, causing it to only work properly when that setting was enabled, this should fix it.

Maybe would be a good idea to rewrite that switch logic into proper events that we can use to register handlers.

Diyagi commented 2 months ago

Wait, if Enable Mob Death Report is not enabled, an report is never removed from spawnEvents ? The only code i can find that removes something from spawnEvents is the MobFalseSpawn function and the MobDeath function, the latter would need Enable Mob Death Report enabled.

SlashNephy commented 2 months ago

If Enable Mob Death Report is enabled, a notification will appear in chat when a mob is killed. Even if Enable Mob Death Report is disabled, events should be removed from spawnEvents.

So OnMobDeath should be as follows.

Ui.OnMobDeath(ev);

if (skipOrphanReport && spawnEvents.RemoveAll(x => x.Id == ev.Id) == 0)
{
    DalamudLog.Log.Debug("OnDeathMobReport: skipOrphanReport");
    return;
}

if (!enableDeathReport)
{
    return;
}

// print death report ...
SlashNephy commented 2 months ago

Thank you~