|
44 | 44 |
|
45 | 45 | --- @type Button[] |
46 | 46 | DialogKey.playerChoiceButtons = {} |
| 47 | +--- @type Button[] |
| 48 | +DialogKey.specButtons = {} |
47 | 49 | DialogKey.activeOverrideBindings = {} |
48 | 50 |
|
| 51 | +DialogKey.dummyButton = CreateFrame("Button") |
| 52 | + |
49 | 53 | function DialogKey:OnInitialize() |
50 | 54 | DialogKeyNumyDB = DialogKeyNumyDB or {} |
51 | 55 | --- @type DialogKeyDB |
@@ -86,6 +90,9 @@ function DialogKey:ADDON_LOADED(_, addon) |
86 | 90 | if addon == 'Blizzard_PlayerChoice' then |
87 | 91 | self:SecureHook(PlayerChoiceFrame, "TryShow", "OnPlayerChoiceShow") |
88 | 92 | self:SecureHookScript(PlayerChoiceFrame, "OnHide", "OnPlayerChoiceHide") |
| 93 | + elseif addon == 'Blizzard_PlayerSpells' then |
| 94 | + self:SecureHookScript(PlayerSpellsFrame.SpecFrame, "OnShow", "OnSpecFrameShow") |
| 95 | + self:SecureHookScript(PlayerSpellsFrame.SpecFrame, "OnHide", "OnSpecFrameHide") |
89 | 96 | end |
90 | 97 | end |
91 | 98 |
|
@@ -186,6 +193,24 @@ function DialogKey:OnPlayerChoiceHide() |
186 | 193 | self.playerChoiceButtons = {} |
187 | 194 | end |
188 | 195 |
|
| 196 | +function DialogKey:OnSpecFrameShow() |
| 197 | + --- @type FramePool<Frame, ClassSpecContentFrameTemplate> |
| 198 | + local framePool = PlayerSpellsFrame.SpecFrame.SpecContentFramePool |
| 199 | + |
| 200 | + self.specButtons = {} |
| 201 | + for specContentFrame in framePool:EnumerateActive() do |
| 202 | + --- @type ClassSpecContentFrameTemplate |
| 203 | + local specContentFrame = specContentFrame |
| 204 | + self.specButtons[specContentFrame.specIndex] = specContentFrame.ActivateButton |
| 205 | + local text = self.db.handleSpecFrame and (specContentFrame.specIndex .. ' ' .. TALENT_SPEC_ACTIVATE) or TALENT_SPEC_ACTIVATE |
| 206 | + specContentFrame.ActivateButton:SetText(text) |
| 207 | + end |
| 208 | +end |
| 209 | + |
| 210 | +function DialogKey:OnSpecFrameHide() |
| 211 | + self.specButtons = {} |
| 212 | +end |
| 213 | + |
189 | 214 | --- @param GossipFrame GossipFrame |
190 | 215 | function DialogKey:OnGossipFrameUpdate(GossipFrame) |
191 | 216 | local scrollbox = GossipFrame.GreetingPanel.ScrollBox |
@@ -369,6 +394,8 @@ function DialogKey:ShouldIgnoreInput() |
369 | 394 | and not self:GetFirstVisibleCustomFrame() |
370 | 395 | -- Ignore input if no player choice buttons are visible |
371 | 396 | and not next(self.playerChoiceButtons) |
| 397 | + -- Ignore input if no spec buttons are visible |
| 398 | + and not next (self.specButtons) |
372 | 399 | then |
373 | 400 | return true |
374 | 401 | end |
@@ -495,6 +522,17 @@ function DialogKey:HandleKey(key) |
495 | 522 | end |
496 | 523 | end |
497 | 524 |
|
| 525 | + -- Spec Frame |
| 526 | + if self.db.handleSpecFrame and next(self.specButtons) then |
| 527 | + local button = self.specButtons[keynum] |
| 528 | + if button then |
| 529 | + -- blocks keybind for currently selected spec index |
| 530 | + if not button:IsVisible() then button = self.dummyButton end |
| 531 | + self:SetClickbuttonBinding(button, key) |
| 532 | + return |
| 533 | + end |
| 534 | + end |
| 535 | + |
498 | 536 | -- GossipFrame |
499 | 537 | if (doAction or self.db.numKeysForGossip) and GossipFrame.GreetingPanel:IsVisible() then |
500 | 538 | while keynum and keynum > 0 and keynum <= #self.frames do |
|
0 commit comments