Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
166 stars 7 forks source link

Encounter Journal assigns wrong mapIDs to instance data elements #435

Closed Meorawr closed 3 months ago

Meorawr commented 1 year ago

The setup of the instance selection data provider for the encounter journal incorrectly only ever obtains the map ID of the first instance in the list and configures all instances in the data provider with that same map ID.

In the EncounterJournal_ListInstances function this is caused by the second of the EJ_GetInstanceByIndex calls not also updating the mapID variable.

Note that if fixed this may lead to a bug elsewhere where the element initializer for the instance selection grid is missing a corresponding button.ModifiedInstanceIcon:Hide() call if there's no modified instance info available for the supplied map ID.

Quick patch

This fixes both the issues described above, as well as a leak of the uiModelSceneID global in EncounterJournal_DisplayEncounter.

diff --git a/Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua b/Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua
index f88179c5..feb9eacb 100644
--- a/Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua
+++ b/Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua
@@ -417,6 +417,8 @@ function EncounterJournal_OnLoad(self)
                button.ModifiedInstanceIcon.Icon:SetAtlas(atlas, true)
                button.ModifiedInstanceIcon:SetSize(button.ModifiedInstanceIcon.Icon:GetSize());
                button.ModifiedInstanceIcon:Show();
+           else
+               button.ModifiedInstanceIcon:Hide();
            end

        end
@@ -895,7 +897,7 @@ function EncounterJournal_ListInstances()
        });

        dataIndex = dataIndex + 1;
-       instanceID, name, description, _, buttonImage, _, _, _, link = EJ_GetInstanceByIndex(dataIndex, showRaid);
+       instanceID, name, description, _, buttonImage, _, _, _, link, _, mapID = EJ_GetInstanceByIndex(dataIndex, showRaid);
    end

    EncounterJournal.instanceSelect.ScrollBox:SetDataProvider(dataProvider);
@@ -1170,7 +1172,7 @@ function EncounterJournal_DisplayEncounter(encounterID, noButton)
    end

    -- Setup Creatures
-   local id, name, displayInfo, iconImage;
+   local id, name, displayInfo, iconImage, uiModelSceneID;
    for i=1,MAX_CREATURES_PER_ENCOUNTER do
        id, name, description, displayInfo, iconImage, uiModelSceneID = EJ_GetCreatureInfo(i);
Meorawr commented 3 months ago

Fixed in 10.2.6 seemingly.