Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit db42b62

Browse files
committed
Fix extrabutton not showing activation
1 parent 286ef13 commit db42b62

5 files changed

Lines changed: 64 additions & 38 deletions

File tree

Neuron.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ function Neuron:OnEnable()
228228

229229
Neuron:Overrides()
230230

231-
--TODO: Get rid of this in the next version
232-
for k,v in pairs(NeuronItemCache) do
233-
NeuronItemCache[k:lower()] = v
234-
end
235-
236231
end
237232

238233
--- **OnDisable**, which is only called when your addon is manually being disabled.

Objects/ACTIONBUTTON_DragAndDrop.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,9 @@ end
485485

486486

487487
function ACTIONBUTTON:SetMouseCursor()
488-
489-
if self.spell then
490-
local spellID
491-
_,_,_,_,_,_,spellID = GetSpellInfo(self.spell)
492-
if spellID then
493-
PickupSpell(spellID) --this is to try to catch any stragglers that might not have a spellID on the button. Things like mounts and such
494-
end
495-
if GetCursorInfo() then --if this isn't a normal spell (like a flyout) or it is a pet abiity, revert to a question mark symbol
488+
if self.spell and self.spellID then
489+
PickupSpell(self.spellID)
490+
if GetCursorInfo() then
496491
return
497492
end
498493
end
@@ -502,6 +497,18 @@ function ACTIONBUTTON:SetMouseCursor()
502497
if GetCursorInfo() then --if this isn't a normal spell (like a flyout) or it is a pet abiity, revert to a question mark symbol
503498
return
504499
end
500+
501+
PickupItem(GetItemInfoInstant(self.item))
502+
if GetCursorInfo() then
503+
return
504+
end
505+
506+
if NeuronItemCache[self.item:lower()] then --try to pull the spellID from our ItemCache as a last resort
507+
PickupItem(NeuronItemCache[self.item:lower()])
508+
if GetCursorInfo() then
509+
return
510+
end
511+
end
505512
end
506513

507514
--failsafe so there is 'something' on the mouse cursor

Objects/BUTTON.lua

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ end
631631
-----------------------------------------------------------------------------------------
632632

633633
function BUTTON:UpdateCount()
634-
if self.spell then
634+
if self.actionID then
635+
self:UpdateActionCount()
636+
elseif self.spell then
635637
self:UpdateSpellCount()
636638
elseif self.item then
637639
self:UpdateItemCount()
@@ -667,6 +669,17 @@ function BUTTON:UpdateItemCount()
667669
end
668670
end
669671

672+
673+
function BUTTON:UpdateActionCount()
674+
local count = GetActionCount(self.actionID)
675+
676+
if count and count > 0 then
677+
self.elements.Count:SetText(count)
678+
else
679+
self.elements.Count:SetText("")
680+
end
681+
end
682+
670683
-----------------------------------------------------------------------------------------
671684
------------------------------------- Set Cooldown --------------------------------------
672685
-----------------------------------------------------------------------------------------
@@ -685,7 +698,7 @@ function BUTTON:UpdateCooldown()
685698
end
686699

687700
function BUTTON:UpdateSpellCooldown()
688-
if self.spell then
701+
if self.spell and self.isShown then
689702
local start, duration, enable, modrate = GetSpellCooldown(self.spell)
690703
local charges, maxCharges, chStart, chDuration, chargemodrate = GetSpellCharges(self.spell)
691704

@@ -700,7 +713,7 @@ function BUTTON:UpdateSpellCooldown()
700713
end
701714

702715
function BUTTON:UpdateItemCooldown()
703-
if self.item then
716+
if self.item and self.isShown then
704717
if NeuronItemCache[self.item] then
705718
local start, duration, enable, modrate = GetItemCooldown(NeuronItemCache[self.item])
706719
self:SetCooldownTimer(start, duration, enable, self.cdText, modrate, self.cdcolor1, self.cdcolor2, self.cdAlpha)
@@ -711,7 +724,7 @@ function BUTTON:UpdateItemCooldown()
711724
end
712725

713726
function BUTTON:UpdateActionCooldown()
714-
if self.actionID then
727+
if self.actionID and self.isShown then
715728
if HasAction(self.actionID) then
716729
local start, duration, enable, modrate = GetActionCooldown(self.actionID)
717730
self:SetCooldownTimer(start, duration, enable, self.cdText, modrate, self.cdcolor1, self.cdcolor2, self.cdAlpha)
@@ -951,7 +964,6 @@ function BUTTON:UpdateActionStatus()
951964
elseif type == "item" then
952965
name = GetItemInfo(id)
953966
end
954-
955967
else
956968
self:SetChecked(false)
957969
end
@@ -961,7 +973,7 @@ function BUTTON:UpdateActionStatus()
961973
else
962974
self.elements.Name:SetText("")
963975
end
964-
self.elements.Count:SetText("")
976+
965977
self:UpdateUsable()
966978
end
967979

Objects/EXTRABTN.lua

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ function EXTRABTN:SetType()
5454

5555
self:SetAttribute("type1", "action")
5656

57+
self:SetAttribute("action1", 169) --baseline actionID for most zoneability actions
58+
59+
5760
--action content gets set in UpdateData
5861
self:UpdateData()
5962

6063
self:SetScript("PostClick", function(self) self:UpdateStatus() end)
61-
self:SetScript("OnEnter", function(self, ...) self:OnEnter(...) end)
64+
self:SetScript("OnEnter", function(self) self:UpdateTooltip() end)
6265
self:SetScript("OnLeave", GameTooltip_Hide)
6366

6467
self:SetSkinned()
@@ -76,28 +79,35 @@ end
7679

7780
---overwrite function in parent class BUTTON
7881
function EXTRABTN:UpdateData()
79-
--default to 169 as is the most of then the case as of 8.1
80-
self.extraActionID = 169
8182

82-
--get specific extrabutton extraActionID. Try to query it long form, but if it can't will fall back to 169 (as is the 7.0+ default)
83+
--get specific extrabutton actionID. Try to query it long form, but if it can't will fall back to 169 (as is the 7.0+ default)
8384
if HasExtraActionBar() then
85+
--default to 169 as is the most of then the case as of 8.1
86+
self.actionID = 169
87+
8488
local extraPage = GetExtraBarIndex()
85-
self.extraActionID = extraPage*12 - 11 --1st slot on the extraPage (page 15 as of 8.1, so 169)
86-
end
89+
self.actionID = extraPage*12 - 11 --1st slot on the extraPage (page 15 as of 8.1, so 169)
8790

88-
if not InCombatLockdown() then
89-
self:SetAttribute("action1", self.extraActionID)
90-
end
91+
if not InCombatLockdown() then
92+
self:SetAttribute("action1", self.actionID)
93+
end
9194

92-
-----------------------
93-
_, self.spellID = GetActionInfo(self.extraActionID)
94-
95-
if self.spellID then
96-
self.spell = GetSpellInfo(self.spellID);
95+
_, self.spellID = GetActionInfo(self.actionID)
96+
97+
if self.spellID then
98+
self.spell = GetSpellInfo(self.spellID);
99+
else
100+
self.spell = nil
101+
end
97102
else
98-
self.spell = ""
103+
self.actionID = nil
104+
self.spellID = nil
105+
self.spell = nil
99106
end
100107

108+
-----------------------
109+
self.elements.Name:Hide()
110+
101111
self:UpdateObjectVisibility()
102112
self:UpdateIcon()
103113
self:UpdateCooldown()
@@ -132,7 +142,7 @@ function EXTRABTN:UpdateIcon()
132142
end
133143
end
134144

135-
function EXTRABTN:OnEnter()
145+
function EXTRABTN:UpdateTooltip()
136146
if not self.isShown then
137147
return
138148
end

Objects/ZONEABILITYBTN.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function ZONEABILITYBTN:SetType()
6161
end
6262
end)
6363
self:SetScript("PostClick", function(self) self:UpdateStatus() end)
64-
self:SetScript("OnEnter", function(self, ...) self:OnEnter(...) end)
64+
self:SetScript("OnEnter", function(self) self:UpdateTooltip() end)
6565
self:SetScript("OnLeave", GameTooltip_Hide)
6666

6767
self:SetSkinned()
@@ -87,9 +87,11 @@ function ZONEABILITYBTN:UpdateData()
8787
self:SetAttribute("macrotext1", "/cast " .. self.spell .. "();")
8888
end
8989
else
90-
self.spell = ""
90+
self.spell = nil
9191
end
9292

93+
self.elements.Name:Hide()
94+
9395
self:UpdateObjectVisibility()
9496
self:UpdateIcon()
9597
self:UpdateCooldown()
@@ -124,7 +126,7 @@ function ZONEABILITYBTN:UpdateIcon()
124126
end
125127
end
126128

127-
function ZONEABILITYBTN:OnEnter()
129+
function ZONEABILITYBTN:UpdateTooltip()
128130
if not self.isShown then
129131
return
130132
end

0 commit comments

Comments
 (0)