Incompatibility with another addon
LudiusMaximus opened this issue ยท 5 comments
Hi, a user of my little addon "persistent-world-map" today reported that there seems to be some incompatibility.
https://www.curseforge.com/wow/addons/persistent-world-map#c12
Can you find out what is causing this on your side?
OK! Thanks. I guess
EncounterJournal:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -116)
achieves the same effect for me as
ShowUIPanel(EncounterJournal)
HideUIPanel(EncounterJournal)
On top, you could make your code robust against premature calls of ShowUIPanel(EncounterJournal) by checking for the existence of self.instancesLockouts.
This happens because of your ShowUIPanel(EncounterJournal)
call on login. I am hooking its OnShow
on ADDON_LOADED
and therefore the instance data isn't yet available at this point (PLAYER_ENTERING_WORLD
is triggered before UPDATE_INSTANCE_INFO
).
function AddOn:UpdateSavedInstances()
self.instancesLockouts = {}
[...]
end
function AddOn:UpdateInstanceStatusFrame(instanceButton)
[...]
local instances = self.instancesLockouts[instanceButton.instanceID] -- attempt to index field 'instancesLockouts' (a nil value)
if not instances then return end
[...]
end
local function UpdateFrames()
local b1 = _G.EncounterJournalInstanceSelectScrollFrameScrollChildInstanceButton1
if b1 then
AddOn:UpdateInstanceStatusFrame(b1)
end
for i = 1, 100 do
local b = _G["EncounterJournalInstanceSelectScrollFrameinstance" .. i]
if b then
AddOn:UpdateInstanceStatusFrame(b)
end
end
end
frame:SetScript("OnEvent", function(_, event, arg1)
[...]
elseif event == "ADDON_LOADED" and arg1 == "Blizzard_EncounterJournal" then
_G.EncounterJournal:HookScript("OnShow", UpdateFrames) -- conflict happens here
hooksecurefunc("EncounterJournal_ListInstances", UpdateFrames)
elseif event == "BOSS_KILL" then
RequestRaidInfo()
elseif event == "UPDATE_INSTANCE_INFO" then
AddOn:RequestWarfrontInfo()
AddOn:UpdateSavedInstances()
UpdateFrames()
end
end)
And this is what's conflicting:
startupFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
startupFrame:SetScript("OnEvent", function()
-- Got to call this once to bring the frames into the right position.
-- Otherwise it will be misplaced when Show() is the first called function.
ShowUIPanel(EncounterJournal)
HideUIPanel(EncounterJournal)
This is also a pretty hacky way to solve your issue.
I think showing a frame on PLAYER_ENTERING_WORLD
is a very uncommon practice and shouldn't happen at all because the player can't even see it at that moment. So I don't think I should do a nil check here.
I also think SetPoint
is the right way to handle your issue, thanks for changing it. Our add-ons should not conflict now.
Cool. Which event would you use to show a frame right after the client finished loading? Is there anything after PLAYER_ENTERING_WORLD?