DialogKey DF

DialogKey DF

36k Downloads

WOTLK: sometimes QuestFrameGreetingPanel.titleButtonPool is null. Fix included

Querke opened this issue ยท 1 comments

commented

I had an issue on WOTLK with quest npc with more than one option (tested on Tactical Officer Kilrath in wintergrasp).
I looked at old versions of dialogkey and reverted back to the old way of doing it.

If you replace the entire DialogKey:EnumerateGossips(isGossipFrame) starting on line 280 in main.lua, with this code, it should work (don't know if author wants to implement this):

 function DialogKey:EnumerateGossips(isGossipFrame)
     if not ( QuestFrameGreetingPanel:IsVisible() or GossipFrame.GreetingPanel:IsVisible() ) then return end
     
     DialogKey.frames = {}
     if isGossipFrame then
   	  for _, v in pairs{ GossipFrame.GreetingPanel.ScrollBox.ScrollTarget:GetChildren() } do
   		  if v:GetObjectType() == "Button" and v:IsVisible() then
   			  table.insert(DialogKey.frames, v)
   		  end
   	  end
     else 
   	  if QuestFrameGreetingPanel.titleButtonPool then
   		  for f,unknown in QuestFrameGreetingPanel.titleButtonPool:EnumerateActive() do
   			  table.insert(DialogKey.frames, f)
   		  end
   	  elseif QuestTitleButton1:IsVisible() then
   		  for i=1,10 do
   			  local frame = _G["QuestTitleButton"..i]
   			  
   			  if frame:IsVisible() and frame:GetText() ~= "" then
   				  table.insert(DialogKey.frames, frame)
   			  end
   		  end
   	  end
     end
 
     table.sort(DialogKey.frames, function(a,b) 
   	  if a.GetOrderIndex then
   		  return a:GetOrderIndex() < b:GetOrderIndex()
   	  else
   		  return a:GetTop() > b:GetTop()
   	  end
     end)
 
     if DialogKey.db.global.numKeysForGossip and not isGossipFrame then
   	  for i, frame in ipairs(DialogKey.frames) do
   		  if i > 10 then break end
   		  frame:SetText(i%10 .. ". " .. frame:GetText())
 
   		  -- Make the button taller if the text inside is wrapped to multiple lines
   		  frame:SetHeight(frame:GetFontString():GetHeight()+2)
   	  end
     end
 end

The problem was that in my case, the QuestFrameGreetingPanel.titleButtonPool was null.

Disclaimer: The old way of doing "QuestFrameGreetingsPanel.titleButtonPool was:
QuestFrameGreetingPanel.titleButtonPool.activeObjects
and is now replaced with: QuestFrameGreetingPanel.titleButtonPool:EnumerateActive(),

Not sure if this breaks anything.

commented

This version of DialogKey not working in Classic is expected - the original version still exists and works perfectly fine on the Legion client that runs all of Classic right now.