DialogKey DF

DialogKey DF

36k Downloads

GetOrderIndex error with QuestFrame

mbattersby opened this issue ยท 3 comments

commented

DialogKey-DF errors when talking to the NPC (Therazal) in Valdrakken that gives out The Great Vault quest.

Message: Interface/AddOns/DialogKey/main.lua:287: attempt to call method 'GetOrderIndex' (a nil value)
Time: Wed Dec 14 10:37:50 2022
Count: 1
Stack: Interface/AddOns/DialogKey/main.lua:287: attempt to call method 'GetOrderIndex' (a nil value)
[string "@Interface/AddOns/DialogKey/main.lua"]:287: in function <Interface/AddOns/DialogKey/main.lua:287>
[string "=[C]"]: in function `sort'
[string "@Interface/AddOns/DialogKey/main.lua"]:287: in function `EnumerateGossips'
[string "@Interface/AddOns/DialogKey/main.lua"]:64: in function <Interface/AddOns/DialogKey/main.lua:60>

Locals: a = Button {
 0 = <userdata>
 Icon = QuestFrameGreetingPanelQuestIcon {
 }
 isActive = 1
}
b = Button {
 0 = <userdata>
 Icon = QuestFrameGreetingPanelQuestIcon {
 }
 isActive = 1
}
(*temporary) = nil
(*temporary) = Button {
 0 = <userdata>
 Icon = QuestFrameGreetingPanelQuestIcon {
 }
 isActive = 1
}
(*temporary) = "attempt to call method 'GetOrderIndex' (a nil value)"

Edit: this is the dialog:

image

commented

Only have one other addon loaded, Clique, and that is only to pull in CallbackHandler-1.0 (see #20).

commented

Reverting the sort to using GetTop resolves the issue:

diff --git a/main.lua b/main.lua
index 28daa77..0223cfc 100644
--- a/main.lua
+++ b/main.lua
@@ -284,7 +284,7 @@ function DialogKey:EnumerateGossips(isGossipFrame)
                end
        end

-       table.sort(DialogKey.frames, function(a,b) return a:GetOrderIndex() < b:GetOrderIndex() end)
+       table.sort(DialogKey.frames, function(a,b) return a:GetTop() > b:GetTop() end)

        if DialogKey.db.global.numKeysForGossip and not isGossipFrame then
                for i, frame in ipairs(DialogKey.frames) do
commented

This was fixed in 1.4.3.

The GetOrderIndex() is required for Immersion compatibility, so I just put in a check to see if the function exists before calling it.