Skip to content

Commit 9212828

Browse files
committed
Fix mismatch between dialog numbering and the num keybinds in certain situations (fixes #7)
1 parent f0d3c9e commit 9212828

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

main.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,28 +541,29 @@ function DialogKey:EnumerateGossips()
541541
end
542542
end
543543

544+
local frames = {}
544545
self.frames = {}
545546
if QuestFrameGreetingPanel and QuestFrameGreetingPanel.titleButtonPool then
546547
--- @type FramePool<Button, QuestTitleButtonTemplate>
547548
local pool = QuestFrameGreetingPanel.titleButtonPool
548549
for tab in (pool:EnumerateActive()) do
549550
if tab:GetObjectType() == "Button" then
550-
table.insert(self.frames, tab)
551+
table.insert(frames, tab)
551552
end
552553
end
553554
elseif QuestFrameGreetingPanel and not QuestFrameGreetingPanel.titleButtonPool then
554555
--- @type ScriptRegion[]
555556
local children = { QuestGreetingScrollChildFrame:GetChildren() }
556557
for _, child in ipairs(children) do
557558
if child:GetObjectType() == "Button" and child:IsVisible() then
558-
table.insert(self.frames, child)
559+
table.insert(frames, child)
559560
end
560561
end
561562
else
562563
return
563564
end
564565

565-
table.sort(self.frames, function(a,b)
566+
table.sort(frames, function(a,b)
566567
if a.GetOrderIndex then
567568
return a:GetOrderIndex() < b:GetOrderIndex()
568569
else
@@ -572,7 +573,7 @@ function DialogKey:EnumerateGossips()
572573

573574
if self.db.numKeysForGossip then
574575
local n = 1
575-
for i, frame in ipairs(self.frames) do
576+
for i, frame in ipairs(frames) do
576577
if not checkQuestsToHandle or questsToHandle[i] then
577578
if n > 10 then break end
578579
local oldText = frame:GetText()
@@ -585,6 +586,11 @@ function DialogKey:EnumerateGossips()
585586
end
586587
end
587588
end
589+
for i, frame in ipairs(frames) do
590+
if not checkQuestsToHandle or questsToHandle[i] then
591+
table.insert(self.frames, frame)
592+
end
593+
end
588594
end
589595

590596
-- Glow Functions --

0 commit comments

Comments
 (0)