GurliGebis / WoWAddon-BattlePetCompletionist

GNU General Public License v3.0
7 stars 2 forks source link

The War Within support #34

Closed GurliGebis closed 3 months ago

GurliGebis commented 4 months ago
GurliGebis commented 4 months ago

@davidmc24 I have been trying to figure this one out: https://github.com/GurliGebis/WoWAddon-BattlePetCompletionist/blob/0b64a46c72b7cecd0b67e2dd80e653af76b42065/Modules/Map/MapModule.lua#L201

In TWW, they have change the way the Map Filter button and menu works on the map. This means that the overlay frame for the map filter no longer has the InitializeDropDown function.

I have been looking at the code changes they have done (the wow-ui-souce repo), and I haven't been able to figure out how to insert into the menu.

Do you have any ideas?

davidmc24 commented 4 months ago

If you want to do it with a hook, I think that maybe the function you'd want is WorldMapTrackingOptionsButtonMixin:BuildFilterTable.

https://github.com/Gethe/wow-ui-source/blob/beta/Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMapTemplates.lua#L253

Alternatively, it might be possible to do what you want in response to a click/mousedown event. That appears to be how Plumber adds its filter options, and might be easier to update across versions.

https://github.com/Peterodox/Plumber/blob/7328e428a6736a57dd0c02339e12f275de181627/Modules/MapPin.lua#L1197

GurliGebis commented 4 months ago

Thank you, I will take a look at when I get time 🙂👍

GurliGebis commented 3 months ago

@davidmc24 it looks like I have to mess with the SetupMenu function as well (cannot test right now, since beta is offline, and PTR is broken) - any ideas on how to hook into that?

My plan for hooking into the BuildFilterTable function is like this:

    AceHook:SecureHook(WorldMapFrame.overlayFrames[2], "BuildFilterTable", function()
        local function AddFilter(text, cvarName, trackingFilter, cvarIsOnlyIndex)
            local actualCVarName = not cvarIsOnlyIndex and cvarName or nil;
            WorldMapFrame.overlayFrames[2].worldMapFilters[cvarName] = CreateAndInitFromMixin(WorldMapFilterMixin, text, actualCVarName, trackingFilter);
        end

        AddFilter("Battle Pets", "worldMapBattlePets");
    end)

Not tested, since beta is offline 🙂

davidmc24 commented 3 months ago

So... I was going to try to dig into this and see what progress I could make with testing an approach, since the servers seem to be back up. But apparently that isn't meant to be, as at least for me, the character login process hangs at 60% or so (post). Possibly a Mac-specific bug. Will check again tomorrow.

GurliGebis commented 3 months ago

Yeah, it seems a bit unstable at the moment 🙂 It looks like the new logic stores the enable flag as cvars, so I think we need to change how it works.

My idea currently is to store the enable bit as a cvars, and then just the kind of filter as a DB string like it is now. Then we need to change the settings dialog to have an enable checkbox first, and remove the None option from the dropdown in there. (If it is set to None currently, it should default to Missing when upgrade I think)

Does that sound like an idea?

davidmc24 commented 3 months ago

Still can't get in. "The Blue Bar boss is too strong." - Dunhear

Yes, if the filters enablement is now stored as CVars, then removing the None filter option makes sense. I agree with migrating None to Missing if needed.

GurliGebis commented 3 months ago

I managed to hook into the BuildFilterTable function, but it is never called. Tried the BuildMenu, function, but it doesn't seem like there is a great way to add to the menu.

Also, it looks like we need to hook into more than this, for it to work.

BuildFilter is needed to populate the worldMapFilters list, the SetupMenu is needed to add to the menu list.

But since I'm unable to get anywhere with it, I'm not sure this is even possible. If I disable this part, the addon seems to working just fine, so worst case, we can just disable the filter in there for now.

davidmc24 commented 3 months ago

Disabling this part for now seems like a pragmatic approach. I suspect we'll find a way to get it to work eventually, but it might need to wait until some other addon figures out a path first.

GurliGebis commented 3 months ago

Yep, that is my thoughts as well - let someone else figure out how to do it :) Now, if only I could figure out how to append stuff to the new quest log for one of my other addons.

They really refactored most of the UI this time around.

GurliGebis commented 2 months ago

@davidmc24 I got some help with my other addon, which showed me the Menu.ModifyMenu function call. So the toggle from the dropdown is back again 😃