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

Commit 43f989d

Browse files
committed
Override UpdateCooldown to keep it from being called at erroneous times
1 parent 5f013de commit 43f989d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

Objects/EXTRABTN.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ function EXTRABTN:SetType()
5757
self:RegisterEvent("ZONE_CHANGED", "OnEvent")
5858
self:RegisterEvent("SPELLS_CHANGED", "OnEvent")
5959
self:RegisterEvent("PLAYER_ENTERING_WORLD", "OnEvent")
60-
--self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "OnEvent")
61-
--self:RegisterEvent("SPELL_UPDATE_CHARGES", "OnEvent")
62-
--self:RegisterEvent("SPELL_UPDATE_USABLE", "OnEvent")
60+
self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "OnEvent")
61+
self:RegisterEvent("SPELL_UPDATE_CHARGES", "OnEvent")
62+
self:RegisterEvent("SPELL_UPDATE_USABLE", "OnEvent")
6363

6464
self:SetAttribute("type1", "action")
6565

@@ -71,6 +71,8 @@ function EXTRABTN:SetType()
7171
self:SetScript("OnLeave", GameTooltip_Hide)
7272

7373
self:SetSkinned()
74+
75+
test = self;
7476
end
7577

7678

@@ -109,7 +111,7 @@ function EXTRABTN:UpdateButton()
109111
if self.spellID then
110112
self:UpdateIcon()
111113

112-
self:SetSpellCooldown(self.spellID) --for some reason this doesn't work if you give it self.spellName. The cooldown will be nil
114+
self:UpdateCooldown()
113115

114116
---extra button charges (some quests have ability charges)
115117
self:UpdateSpellCount(self.spellID)
@@ -120,6 +122,13 @@ function EXTRABTN:UpdateButton()
120122

121123
end
122124

125+
---overwrite function in parent class BUTTON
126+
function EXTRABTN:UpdateCooldown()
127+
if self.spellID then
128+
self:SetSpellCooldown(self.spellID) --for some reason this doesn't work if you give it self.spellName. The cooldown will be nil
129+
end
130+
end
131+
123132

124133
function EXTRABTN:SetObjectVisibility()
125134

Objects/ZONEABILITYBTN.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function ZONEABILITYBTN:UpdateButton()
101101
self:SetAttribute("macrotext1", "/cast " .. self.spellName .. "();")
102102
end
103103

104-
self:SetSpellCooldown(self.spellName)
104+
self:UpdateCooldown()
105105

106106
---zone ability button charges (I'm not sure if zone abilities have charges, but this is just in case)
107107
self:UpdateSpellCount(self.spellName)
@@ -112,6 +112,12 @@ function ZONEABILITYBTN:UpdateButton()
112112

113113
end
114114

115+
---overwrite function in parent class BUTTON
116+
function ZONEABILITYBTN:UpdateCooldown()
117+
if self.spellName then
118+
self:SetSpellCooldown(self.spellName)
119+
end
120+
end
115121

116122
function ZONEABILITYBTN:SetObjectVisibility(show)
117123

0 commit comments

Comments
 (0)