flickerstreak@1
|
1 -- private constants
|
flickerstreak@1
|
2 local namePrefix = "ReActionButton_"
|
flickerstreak@1
|
3 local _G = getfenv(0)
|
flickerstreak@1
|
4 local ACTION_FREE = { }
|
flickerstreak@1
|
5 local MAX_ACTIONS = 120
|
flickerstreak@1
|
6
|
flickerstreak@1
|
7 local hotKeyDefaultColor = { r=1.0, g=1.0, b=1.0, a=1.0 }
|
flickerstreak@1
|
8 local hotKeyDisabledColor = { r=0.6, g=0.6, b=0.6, a=1.0 }
|
flickerstreak@1
|
9 local hotKeyOutOfRangeColor = { r=1.0, g=0.2, b=0.2, a=1.0 }
|
flickerstreak@1
|
10
|
flickerstreak@1
|
11 local hotKeyModifierColors = {
|
flickerstreak@1
|
12 S = { r=0.6, g=0.6, b=1.0, a=1.0 }, -- shift
|
flickerstreak@1
|
13 C = { r=1.0, g=0.82, b=0, a=1.0 }, -- ctrl
|
flickerstreak@1
|
14 A = { r=0.1, g=1.0, b=0.1, a=1.0 }, -- alt
|
flickerstreak@1
|
15 }
|
flickerstreak@1
|
16
|
flickerstreak@1
|
17 local equippedActionBorderColor = { r=0, g=1.0, b=0, a=0.35 }
|
flickerstreak@1
|
18
|
flickerstreak@1
|
19 local actionUsableColor = { r=1.0, g=1.0, b=1.0, a=1.0 }
|
flickerstreak@1
|
20 local actionNotUsableColor = { r=0.4, g=0.4, b=0.4, a=1.0 }
|
flickerstreak@1
|
21 local actionNotEnoughManaColor = { r=0.2, g=0.2, b=0.7, a=1.0 }
|
flickerstreak@1
|
22 local actionOutOfRangeColor = { r=1.0, g=0.2, b=0.2, a=1.0 }
|
flickerstreak@1
|
23
|
flickerstreak@1
|
24 -- private variables
|
flickerstreak@1
|
25 local kbValidate = AceLibrary("AceConsole-2.0").keybindingValidateFunc
|
flickerstreak@1
|
26 local actionButtonTbl = { }
|
flickerstreak@1
|
27
|
flickerstreak@1
|
28
|
flickerstreak@1
|
29
|
flickerstreak@1
|
30 -- ReActionButton is a class prototype object.
|
flickerstreak@1
|
31 ReActionButton = AceLibrary("AceOO-2.0").Class("AceEvent-2.0")
|
flickerstreak@1
|
32
|
flickerstreak@1
|
33 -------------------
|
flickerstreak@1
|
34 -- Class methods
|
flickerstreak@1
|
35 -------------------
|
flickerstreak@1
|
36
|
flickerstreak@1
|
37 -- In addition to supporting the 'new' creation method (in which case an action ID must be specified directly),
|
flickerstreak@1
|
38 -- ReActionButton supports the 'acquire'/'release' creation method, which recycles objects and manages actionID assignment.
|
flickerstreak@1
|
39
|
flickerstreak@1
|
40 function ReActionButton:acquire(parent, config, barIdx)
|
flickerstreak@1
|
41 local id = nil
|
flickerstreak@1
|
42 for i = 1, MAX_ACTIONS do
|
flickerstreak@1
|
43 if actionButtonTbl[i] == nil or actionButtonTbl[i].inUse == false then
|
flickerstreak@1
|
44 id = i
|
flickerstreak@1
|
45 break
|
flickerstreak@1
|
46 end
|
flickerstreak@1
|
47 end
|
flickerstreak@1
|
48
|
flickerstreak@1
|
49 if id == nil then return nil end -- all buttons and action ids are in use
|
flickerstreak@1
|
50
|
flickerstreak@1
|
51 local hint = config.actionIDs[barIdx]
|
flickerstreak@1
|
52 if hint and (actionButtonTbl[hint] == nil or actionButtonTbl[hint].inUse == false) then
|
flickerstreak@1
|
53 id = hint
|
flickerstreak@1
|
54 end
|
flickerstreak@1
|
55
|
flickerstreak@1
|
56 if actionButtonTbl[id] == nil then
|
flickerstreak@1
|
57 actionButtonTbl[id] = { }
|
flickerstreak@1
|
58 end
|
flickerstreak@1
|
59 local t = actionButtonTbl[id]
|
flickerstreak@1
|
60
|
flickerstreak@1
|
61 t.inUse = true
|
flickerstreak@1
|
62 if t.button then
|
flickerstreak@1
|
63 t.button:Configure(parent,config,barIdx,id)
|
flickerstreak@1
|
64 else
|
flickerstreak@1
|
65 t.button = self:new(parent,config,barIdx,id)
|
flickerstreak@1
|
66 end
|
flickerstreak@1
|
67
|
flickerstreak@1
|
68 if actionButtonTbl[t.button:GetActionID()].inUse ~= true then
|
flickerstreak@1
|
69 end
|
flickerstreak@1
|
70
|
flickerstreak@1
|
71 return t.button
|
flickerstreak@1
|
72 end
|
flickerstreak@1
|
73
|
flickerstreak@1
|
74 function ReActionButton:release( b )
|
flickerstreak@1
|
75 if b then
|
flickerstreak@1
|
76 actionButtonTbl[b:GetActionID()].inUse = false
|
flickerstreak@1
|
77 b:Recycle()
|
flickerstreak@1
|
78 end
|
flickerstreak@1
|
79 end
|
flickerstreak@1
|
80
|
flickerstreak@1
|
81
|
flickerstreak@1
|
82
|
flickerstreak@1
|
83 function ReActionButton:ShowAllActionIDs()
|
flickerstreak@1
|
84 for _, b in ipairs(actionButtonTbl) do
|
flickerstreak@1
|
85 b:ShowActionID()
|
flickerstreak@1
|
86 end
|
flickerstreak@1
|
87 end
|
flickerstreak@1
|
88
|
flickerstreak@1
|
89 function ReActionButton:HideAllActionIDs()
|
flickerstreak@1
|
90 for _, b in ipairs(actionButtonTbl) do
|
flickerstreak@1
|
91 b:HideActionID()
|
flickerstreak@1
|
92 end
|
flickerstreak@1
|
93 end
|
flickerstreak@1
|
94
|
flickerstreak@1
|
95
|
flickerstreak@1
|
96 ----------------------
|
flickerstreak@1
|
97 -- Instance methods
|
flickerstreak@1
|
98 ----------------------
|
flickerstreak@1
|
99 function ReActionButton.prototype:init( parentFrame, config, barIdx, id )
|
flickerstreak@1
|
100 ReActionButton.super.prototype.init(self)
|
flickerstreak@1
|
101
|
flickerstreak@1
|
102 -- create the button widget
|
flickerstreak@1
|
103 self.name = namePrefix.."_"..id
|
flickerstreak@1
|
104 self.button = CreateFrame("CheckButton", self.name, parentFrame, "ReActionButtonTemplate")
|
flickerstreak@1
|
105
|
flickerstreak@1
|
106 -- create the actionID label on the control widget
|
flickerstreak@1
|
107 local actionIDLabel = self.button:CreateFontString(nil,"ARTWORK", "NumberFontNormalSmall")
|
flickerstreak@1
|
108 actionIDLabel:SetPoint("BOTTOMLEFT",0,0)
|
flickerstreak@1
|
109 actionIDLabel:Hide()
|
flickerstreak@1
|
110
|
flickerstreak@1
|
111 -- store references to the various sub-frames so we don't have to look it up all the time
|
flickerstreak@1
|
112 self.frames = {
|
flickerstreak@1
|
113 hotkey = _G[self.name.."HotKey"],
|
flickerstreak@1
|
114 count = _G[self.name.."Count"],
|
flickerstreak@1
|
115 cooldown = _G[self.name.."Cooldown"],
|
flickerstreak@1
|
116 -- nCooldown = _G[self.name.."CooldownNumeric"],
|
flickerstreak@1
|
117 macro = _G[self.name.."Name"],
|
flickerstreak@1
|
118 icon = _G[self.name.."Icon"],
|
flickerstreak@1
|
119 border = _G[self.name.."Border"],
|
flickerstreak@1
|
120 normalTexture = _G[self.name.."NormalTexture"],
|
flickerstreak@1
|
121 flash = _G[self.name.."Flash"],
|
flickerstreak@1
|
122 actionID = actionIDLabel
|
flickerstreak@1
|
123 }
|
flickerstreak@1
|
124
|
flickerstreak@1
|
125 -- provide a reference back to this object for the frame to use in event handlers
|
flickerstreak@1
|
126 self.button.rxnBtn = self
|
flickerstreak@1
|
127
|
flickerstreak@1
|
128 -- initialize
|
flickerstreak@1
|
129 self:Configure(parentFrame, config, barIdx, id)
|
flickerstreak@1
|
130 end
|
flickerstreak@1
|
131
|
flickerstreak@1
|
132 function ReActionButton.prototype:Recycle()
|
flickerstreak@1
|
133 local b = self.button
|
flickerstreak@1
|
134 local action = self:GetActionID()
|
flickerstreak@1
|
135
|
flickerstreak@1
|
136 self.config.actionIDs[self.barIdx] = nil
|
flickerstreak@1
|
137
|
flickerstreak@1
|
138 self:SetKeyBinding(nil)
|
flickerstreak@1
|
139 self:UpdateDisplay()
|
flickerstreak@1
|
140 b:UnregisterAllEvents()
|
flickerstreak@1
|
141 b:Hide()
|
flickerstreak@1
|
142 b:ClearAllPoints()
|
flickerstreak@1
|
143 b:SetParent(ReActionButtonRecycleFrame)
|
flickerstreak@1
|
144 end
|
flickerstreak@1
|
145
|
flickerstreak@1
|
146
|
flickerstreak@1
|
147
|
flickerstreak@1
|
148 -- set the button location
|
flickerstreak@1
|
149 function ReActionButton.prototype:PlaceButton(point, x, y, sz)
|
flickerstreak@1
|
150 local b = self.button
|
flickerstreak@1
|
151 local scale = sz / 36
|
flickerstreak@1
|
152 b:ClearAllPoints()
|
flickerstreak@1
|
153 b:SetScale( scale )
|
flickerstreak@1
|
154 b:SetPoint(point,x/scale,y/scale)
|
flickerstreak@1
|
155 end
|
flickerstreak@1
|
156
|
flickerstreak@1
|
157
|
flickerstreak@1
|
158 function ReActionButton.prototype:ShowActionID()
|
flickerstreak@1
|
159 self.frames.actionID:Show()
|
flickerstreak@1
|
160 end
|
flickerstreak@1
|
161
|
flickerstreak@1
|
162 function ReActionButton.prototype:HideActionID()
|
flickerstreak@1
|
163 self.frames.actionID:Hide()
|
flickerstreak@1
|
164 end
|
flickerstreak@1
|
165
|
flickerstreak@1
|
166
|
flickerstreak@1
|
167
|
flickerstreak@1
|
168 -- configuration and setup
|
flickerstreak@1
|
169 function ReActionButton.prototype:Configure( parentFrame, config, barIdx, id )
|
flickerstreak@1
|
170 self.config = config
|
flickerstreak@1
|
171 self.barIdx = barIdx
|
flickerstreak@1
|
172 self.showGrid = config.showGrid and 1 or 0
|
flickerstreak@1
|
173
|
flickerstreak@1
|
174 self.button:ClearAllPoints()
|
flickerstreak@1
|
175 self.button:SetParent(parentFrame)
|
flickerstreak@1
|
176
|
flickerstreak@1
|
177 self:SetupAttributes()
|
flickerstreak@1
|
178 self:RegisterStaticEvents()
|
flickerstreak@1
|
179
|
flickerstreak@1
|
180 if id then
|
flickerstreak@1
|
181 -- set action ID
|
flickerstreak@1
|
182 self:SetActionID(id)
|
flickerstreak@1
|
183 else
|
flickerstreak@1
|
184 self:ApplyActionID()
|
flickerstreak@1
|
185 end
|
flickerstreak@1
|
186 self:ApplyLayout()
|
flickerstreak@1
|
187 self:ApplyStyle()
|
flickerstreak@1
|
188
|
flickerstreak@1
|
189 self:UpdateDisplay()
|
flickerstreak@1
|
190 end
|
flickerstreak@1
|
191
|
flickerstreak@1
|
192 function ReActionButton.prototype:SetupAttributes()
|
flickerstreak@1
|
193 local b = self.button
|
flickerstreak@1
|
194 b:SetAttribute("type", "action")
|
flickerstreak@1
|
195 b:SetAttribute("shift-type*", ATTRIBUTE_NOOP)
|
flickerstreak@1
|
196 b:SetAttribute("alt-type*", ATTRIBUTE_NOOP)
|
flickerstreak@1
|
197 b:SetAttribute("checkselfcast", true)
|
flickerstreak@1
|
198 b:SetAttribute("useparent-unit", true)
|
flickerstreak@1
|
199 end
|
flickerstreak@1
|
200
|
flickerstreak@1
|
201 function ReActionButton.prototype:RegisterStaticEvents()
|
flickerstreak@1
|
202 self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
flickerstreak@1
|
203 self:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
flickerstreak@1
|
204 self:RegisterEvent("UPDATE_BINDINGS")
|
flickerstreak@1
|
205 self:RegisterEvent("ACTIONBAR_SHOWGRID")
|
flickerstreak@1
|
206 self:RegisterEvent("ACTIONBAR_HIDEGRID")
|
flickerstreak@1
|
207 end
|
flickerstreak@1
|
208
|
flickerstreak@1
|
209 function ReActionButton.prototype:RegisterActionEvents()
|
flickerstreak@1
|
210 self:RegisterEvent("ACTIONBAR_UPDATE_STATE")
|
flickerstreak@1
|
211 self:RegisterEvent("ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
212 self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
213 self:RegisterEvent("UPDATE_INVENTORY_ALERTS", "ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
214 self:RegisterEvent("PLAYER_AURAS_CHANGED", "ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
215 self:RegisterEvent("PLAYER_TARGET_CHANGED", "ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
216 self:RegisterEvent("UNIT_INVENTORY_CHANGED")
|
flickerstreak@1
|
217 self:RegisterEvent("CRAFT_SHOW")
|
flickerstreak@1
|
218 self:RegisterEvent("CRAFT_CLOSE", "CRAFT_SHOW")
|
flickerstreak@1
|
219 self:RegisterEvent("TRADE_SKILL_SHOW", "CRAFT_SHOW")
|
flickerstreak@1
|
220 self:RegisterEvent("TRADE_SKILL_CLOSE", "CRAFT_SHOW")
|
flickerstreak@1
|
221 self:RegisterEvent("PLAYER_ENTER_COMBAT", "CRAFT_SHOW")
|
flickerstreak@1
|
222 self:RegisterEvent("PLAYER_LEAVE_COMBAT")
|
flickerstreak@1
|
223 self:RegisterEvent("START_AUTOREPEAT_SPELL")
|
flickerstreak@1
|
224 self:RegisterEvent("STOP_AUTOREPEAT_SPELL")
|
flickerstreak@1
|
225
|
flickerstreak@1
|
226 self.button:SetScript("OnUpdate", function() self:OnUpdate(arg1) end)
|
flickerstreak@1
|
227 self.actionEventsRegistered = true
|
flickerstreak@1
|
228 end
|
flickerstreak@1
|
229
|
flickerstreak@1
|
230 function ReActionButton.prototype:UnregisterActionEvents()
|
flickerstreak@1
|
231 self:UnregisterEvent("ACTIONBAR_UPDATE_STATE")
|
flickerstreak@1
|
232 self:UnregisterEvent("ACTIONBAR_UPDATE_USABLE")
|
flickerstreak@1
|
233 self:UnregisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
|
flickerstreak@1
|
234 self:UnregisterEvent("UPDATE_INVENTORY_ALERTS")
|
flickerstreak@1
|
235 self:UnregisterEvent("PLAYER_AURAS_CHANGED")
|
flickerstreak@1
|
236 self:UnregisterEvent("PLAYER_TARGET_CHANGED")
|
flickerstreak@1
|
237 self:UnregisterEvent("UNIT_INVENTORY_CHANGED")
|
flickerstreak@1
|
238 self:UnregisterEvent("CRAFT_SHOW")
|
flickerstreak@1
|
239 self:UnregisterEvent("CRAFT_CLOSE")
|
flickerstreak@1
|
240 self:UnregisterEvent("TRADE_SKILL_SHOW")
|
flickerstreak@1
|
241 self:UnregisterEvent("TRADE_SKILL_CLOSE")
|
flickerstreak@1
|
242 self:UnregisterEvent("PLAYER_ENTER_COMBAT")
|
flickerstreak@1
|
243 self:UnregisterEvent("PLAYER_LEAVE_COMBAT")
|
flickerstreak@1
|
244 self:UnregisterEvent("START_AUTOREPEAT_SPELL")
|
flickerstreak@1
|
245 self:UnregisterEvent("STOP_AUTOREPEAT_SPELL")
|
flickerstreak@1
|
246
|
flickerstreak@1
|
247 self.button:SetScript("OnUpdate", nil)
|
flickerstreak@1
|
248 self.actionEventsRegistered = false
|
flickerstreak@1
|
249 end
|
flickerstreak@1
|
250
|
flickerstreak@1
|
251
|
flickerstreak@1
|
252 -- event handlers
|
flickerstreak@1
|
253 function ReActionButton.prototype:ACTIONBAR_SLOT_CHANGED()
|
flickerstreak@1
|
254 if arg1 == 0 or arg1 == self:GetActionID() then
|
flickerstreak@1
|
255 self:UpdateDisplay()
|
flickerstreak@1
|
256 end
|
flickerstreak@1
|
257 end
|
flickerstreak@1
|
258
|
flickerstreak@1
|
259 function ReActionButton.prototype:PLAYER_ENTERING_WORLD()
|
flickerstreak@1
|
260 self:UpdateDisplay()
|
flickerstreak@1
|
261 end
|
flickerstreak@1
|
262
|
flickerstreak@1
|
263 function ReActionButton.prototype:UPDATE_BINDINGS()
|
flickerstreak@1
|
264 self:UpdateDisplay()
|
flickerstreak@1
|
265 end
|
flickerstreak@1
|
266
|
flickerstreak@1
|
267 function ReActionButton.prototype:ACTIONBAR_SHOWGRID()
|
flickerstreak@1
|
268 self:ShowGridTmp()
|
flickerstreak@1
|
269 end
|
flickerstreak@1
|
270
|
flickerstreak@1
|
271 function ReActionButton.prototype:ACTIONBAR_HIDEGRID()
|
flickerstreak@1
|
272 self:HideGridTmp()
|
flickerstreak@1
|
273 end
|
flickerstreak@1
|
274
|
flickerstreak@1
|
275 function ReActionButton.prototype:ACTIONBAR_UPDATE_STATE()
|
flickerstreak@1
|
276 self:UpdateCheckedState()
|
flickerstreak@1
|
277 end
|
flickerstreak@1
|
278
|
flickerstreak@1
|
279 function ReActionButton.prototype:ACTIONBAR_UPDATE_USABLE()
|
flickerstreak@1
|
280 self:UpdateUsable()
|
flickerstreak@1
|
281 self:UpdateCooldown()
|
flickerstreak@1
|
282 self:ColorHotKey()
|
flickerstreak@1
|
283 end
|
flickerstreak@1
|
284
|
flickerstreak@1
|
285 function ReActionButton.prototype:UNIT_INVENTORY_CHANGED()
|
flickerstreak@1
|
286 if arg1 == "player" then
|
flickerstreak@1
|
287 self:UpdateDisplay()
|
flickerstreak@1
|
288 end
|
flickerstreak@1
|
289 end
|
flickerstreak@1
|
290
|
flickerstreak@1
|
291 function ReActionButton.prototype:CRAFT_SHOW()
|
flickerstreak@1
|
292 self:UpdateCheckedState()
|
flickerstreak@1
|
293 end
|
flickerstreak@1
|
294
|
flickerstreak@1
|
295 function ReActionButton.prototype:PLAYER_ENTER_COMBAT()
|
flickerstreak@1
|
296 if IsAttackAction(self:GetActionID()) then
|
flickerstreak@1
|
297 self:StartFlash()
|
flickerstreak@1
|
298 end
|
flickerstreak@1
|
299 end
|
flickerstreak@1
|
300
|
flickerstreak@1
|
301 function ReActionButton.prototype:PLAYER_LEAVE_COMBAT()
|
flickerstreak@1
|
302 if IsAttackAction(self:GetActionID()) then
|
flickerstreak@1
|
303 self:StopFlash()
|
flickerstreak@1
|
304 end
|
flickerstreak@1
|
305 end
|
flickerstreak@1
|
306
|
flickerstreak@1
|
307 function ReActionButton.prototype:START_AUTOREPEAT_SPELL()
|
flickerstreak@1
|
308 if IsAutoRepeatAction(self:GetActionID()) then
|
flickerstreak@1
|
309 self:StartFlash()
|
flickerstreak@1
|
310 end
|
flickerstreak@1
|
311 end
|
flickerstreak@1
|
312
|
flickerstreak@1
|
313 function ReActionButton.prototype:STOP_AUTOREPEAT_SPELL()
|
flickerstreak@1
|
314 if self:IsFlashing() and not IsAttackAction(self:GetActionID()) then
|
flickerstreak@1
|
315 self:StopFlash()
|
flickerstreak@1
|
316 end
|
flickerstreak@1
|
317 end
|
flickerstreak@1
|
318
|
flickerstreak@1
|
319
|
flickerstreak@1
|
320 -- OnUpdate handler
|
flickerstreak@1
|
321 function ReActionButton.prototype:OnUpdate(elapsed)
|
flickerstreak@1
|
322 local action = self:GetActionID()
|
flickerstreak@1
|
323 local f = self.frames
|
flickerstreak@1
|
324
|
flickerstreak@1
|
325 -- handle flashing
|
flickerstreak@1
|
326 if self:IsFlashing() then
|
flickerstreak@1
|
327 self.flashtime = self.flashtime - elapsed
|
flickerstreak@1
|
328 if self.flashtime <= 0 then
|
flickerstreak@1
|
329 local overtime = -self.flashtime
|
flickerstreak@1
|
330 if overtime >= ATTACK_BUTTON_FLASH_TIME then
|
flickerstreak@1
|
331 overtime = 0
|
flickerstreak@1
|
332 end
|
flickerstreak@1
|
333 self.flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
|
flickerstreak@1
|
334
|
flickerstreak@1
|
335 if f.flash:IsVisible() then
|
flickerstreak@1
|
336 f.flash:Hide()
|
flickerstreak@1
|
337 else
|
flickerstreak@1
|
338 f.flash:Show()
|
flickerstreak@1
|
339 end
|
flickerstreak@1
|
340 end
|
flickerstreak@1
|
341 end
|
flickerstreak@1
|
342
|
flickerstreak@1
|
343 -- Handle range indicator
|
flickerstreak@1
|
344 if self.rangeTimer then
|
flickerstreak@1
|
345 self.rangeTimer = self.rangeTimer - elapsed
|
flickerstreak@1
|
346 if self.rangeTimer <= 0 then
|
flickerstreak@1
|
347 self:ColorHotKey()
|
flickerstreak@1
|
348 self:UpdateUsable()
|
flickerstreak@1
|
349 self.rangeTimer = TOOLTIP_UPDATE_TIME
|
flickerstreak@1
|
350 end
|
flickerstreak@1
|
351 end
|
flickerstreak@1
|
352
|
flickerstreak@1
|
353 -- handle toltip update
|
flickerstreak@1
|
354 if self.tooltipTime then
|
flickerstreak@1
|
355 self.tooltipTime = self.tooltipTime - elapsed
|
flickerstreak@1
|
356 if self.tooltipTime <= 0 then
|
flickerstreak@1
|
357 if GameTooltip:IsOwned(self.button) then
|
flickerstreak@1
|
358 self:UpdateTooltip()
|
flickerstreak@1
|
359 else
|
flickerstreak@1
|
360 self.tooltipTime = nil
|
flickerstreak@1
|
361 end
|
flickerstreak@1
|
362 end
|
flickerstreak@1
|
363 end
|
flickerstreak@1
|
364 end
|
flickerstreak@1
|
365
|
flickerstreak@1
|
366
|
flickerstreak@1
|
367
|
flickerstreak@1
|
368
|
flickerstreak@1
|
369 -- keybinding functions
|
flickerstreak@1
|
370 function ReActionButton.prototype:SetKeyBinding( k )
|
flickerstreak@1
|
371 if k == nil or kbValidate(k) then
|
flickerstreak@1
|
372 local current = self:GetKeyBinding()
|
flickerstreak@1
|
373 ClearOverrideBindings(self.button)
|
flickerstreak@1
|
374 if current then
|
flickerstreak@1
|
375 SetBinding(current,nil)
|
flickerstreak@1
|
376 end
|
flickerstreak@1
|
377 if k then
|
flickerstreak@1
|
378 SetBindingClick(k, self.name, "LeftButton")
|
flickerstreak@1
|
379 end
|
flickerstreak@1
|
380 end
|
flickerstreak@1
|
381 end
|
flickerstreak@1
|
382
|
flickerstreak@1
|
383 function ReActionButton.prototype:GetKeyBinding()
|
flickerstreak@1
|
384 return GetBindingKey("CLICK "..self.name..":LeftButton")
|
flickerstreak@1
|
385 end
|
flickerstreak@1
|
386
|
flickerstreak@1
|
387 function ReActionButton.prototype:ShowAssignKeybinding()
|
flickerstreak@1
|
388 local f = ReActionKeybindFrame
|
flickerstreak@1
|
389 f:ClearAllPoints()
|
flickerstreak@1
|
390 f:SetPoint("BOTTOM", self.button, "TOP", 0, 10)
|
flickerstreak@1
|
391 ReActionKeybindFrameButton.keybindTarget = self
|
flickerstreak@1
|
392 local k = self:GetKeyBinding()
|
flickerstreak@1
|
393 if k then
|
flickerstreak@1
|
394 local txt = GetBindingText(k, "KEY_")
|
flickerstreak@1
|
395 ReActionKeybindFrameButton:SetText(txt or "")
|
flickerstreak@1
|
396 end
|
flickerstreak@1
|
397 f:Show()
|
flickerstreak@1
|
398 end
|
flickerstreak@1
|
399
|
flickerstreak@1
|
400
|
flickerstreak@1
|
401 local mouseButtonConvert = {
|
flickerstreak@1
|
402 LeftButton = "BUTTON1",
|
flickerstreak@1
|
403 RightButton = "BUTTON2",
|
flickerstreak@1
|
404 MiddleButton = "BUTTON3",
|
flickerstreak@1
|
405 Button4 = "BUTTON4",
|
flickerstreak@1
|
406 Button5 = "BUTTON5"
|
flickerstreak@1
|
407 }
|
flickerstreak@1
|
408
|
flickerstreak@1
|
409 function ReActionButton.prototype:HandleKeybindAssign(button, key, mouseButton)
|
flickerstreak@1
|
410 mouseButton = mouseButton and mouseButtonConvert[mouseButton]
|
flickerstreak@1
|
411 if mouseButton ~= "BUTTON1" and mouseButton ~= "BUTTON2" then
|
flickerstreak@1
|
412 key = key or mouseButton
|
flickerstreak@1
|
413 if key == nil or key == "UNKNOWN" or key == "SHIFT" or key == "CTRL" or key == "ALT" then
|
flickerstreak@1
|
414 return
|
flickerstreak@1
|
415 end
|
flickerstreak@1
|
416 if key == "ESCAPE" then
|
flickerstreak@1
|
417 ReActionKeybindFrame:Hide()
|
flickerstreak@1
|
418 return
|
flickerstreak@1
|
419 end
|
flickerstreak@1
|
420 if IsShiftKeyDown() then
|
flickerstreak@1
|
421 key = "SHIFT-"..key
|
flickerstreak@1
|
422 end
|
flickerstreak@1
|
423 if IsControlKeyDown() then
|
flickerstreak@1
|
424 key = "CTRL-"..key
|
flickerstreak@1
|
425 end
|
flickerstreak@1
|
426 if IsAltKeyDown() then
|
flickerstreak@1
|
427 keyPressed = "ALT-"..key
|
flickerstreak@1
|
428 end
|
flickerstreak@1
|
429 local oldAction = GetBindingAction(key)
|
flickerstreak@1
|
430 local oldKey = self:GetKeyBinding()
|
flickerstreak@1
|
431 if oldAction then
|
flickerstreak@1
|
432 -- can't pop a modal dialog box, will need to think something up
|
flickerstreak@1
|
433 end
|
flickerstreak@1
|
434 if oldKey == key then
|
flickerstreak@1
|
435 SetBinding(key,nil)
|
flickerstreak@1
|
436 key = nil
|
flickerstreak@1
|
437 end
|
flickerstreak@1
|
438 self:SetKeyBinding(key)
|
flickerstreak@1
|
439 button:SetText(key and GetBindingText(key, "KEY_") or "")
|
flickerstreak@1
|
440 self:UpdateDisplay()
|
flickerstreak@1
|
441 SaveBindings(2) -- 2 = character specific bindings... hmm...
|
flickerstreak@1
|
442 end
|
flickerstreak@1
|
443 button.selected = false
|
flickerstreak@1
|
444 this:SetButtonState("NORMAL")
|
flickerstreak@1
|
445 end
|
flickerstreak@1
|
446
|
flickerstreak@1
|
447
|
flickerstreak@1
|
448 -- action ID functions
|
flickerstreak@1
|
449 function ReActionButton.prototype:SetActionID( id )
|
flickerstreak@1
|
450 self.config.actionIDs[self.barIdx] = tonumber(id) -- force data integrity
|
flickerstreak@1
|
451 self:ApplyActionID()
|
flickerstreak@1
|
452 end
|
flickerstreak@1
|
453
|
flickerstreak@1
|
454 function ReActionButton.prototype:GetActionID()
|
flickerstreak@1
|
455 return self.config.actionIDs[self.barIdx]
|
flickerstreak@1
|
456 end
|
flickerstreak@1
|
457
|
flickerstreak@1
|
458 function ReActionButton.prototype:ApplyActionID()
|
flickerstreak@1
|
459 local action = tonumber(self:GetActionID())
|
flickerstreak@1
|
460 self.button:SetAttribute("action",action or nil)
|
flickerstreak@1
|
461 self.frames.actionID:SetText(action or "")
|
flickerstreak@1
|
462 end
|
flickerstreak@1
|
463
|
flickerstreak@1
|
464 function ReActionButton.prototype:ShowActionID()
|
flickerstreak@1
|
465 self.frames.actionID:Show()
|
flickerstreak@1
|
466 end
|
flickerstreak@1
|
467
|
flickerstreak@1
|
468 function ReActionButton.prototype:HideActionID()
|
flickerstreak@1
|
469 self.frames.actionID:Hide()
|
flickerstreak@1
|
470 end
|
flickerstreak@1
|
471
|
flickerstreak@1
|
472 function ReActionButton:ShowAllActionIDs() -- class-wide function
|
flickerstreak@1
|
473 for _, tbl in pairs(actionButtonTbl) do
|
flickerstreak@1
|
474 if tbl.button then tbl.button:ShowActionID() end
|
flickerstreak@1
|
475 end
|
flickerstreak@1
|
476 end
|
flickerstreak@1
|
477
|
flickerstreak@1
|
478 function ReActionButton:HideAllActionIDs() -- class-wide function
|
flickerstreak@1
|
479 for _, tbl in pairs(actionButtonTbl) do
|
flickerstreak@1
|
480 if tbl.button then tbl.button:HideActionID() end
|
flickerstreak@1
|
481 end
|
flickerstreak@1
|
482 end
|
flickerstreak@1
|
483
|
flickerstreak@1
|
484
|
flickerstreak@1
|
485 -- action transfer functions
|
flickerstreak@1
|
486 function ReActionButton.prototype:ShouldPickupAction(mouseButton)
|
flickerstreak@1
|
487 return IsShiftKeyDown() and not SecureButton_GetModifiedAttribute(self.button, "type", mouseButton)
|
flickerstreak@1
|
488 end
|
flickerstreak@1
|
489
|
flickerstreak@1
|
490 function ReActionButton.prototype:ShowGridTmp()
|
flickerstreak@1
|
491 self.showGrid = self.showGrid + 1
|
flickerstreak@1
|
492 self:UpdateVisibility()
|
flickerstreak@1
|
493 end
|
flickerstreak@1
|
494
|
flickerstreak@1
|
495 function ReActionButton.prototype:HideGridTmp()
|
flickerstreak@1
|
496 self.showGrid = self.showGrid - 1
|
flickerstreak@1
|
497 self:UpdateVisibility()
|
flickerstreak@1
|
498 end
|
flickerstreak@1
|
499
|
flickerstreak@1
|
500 function ReActionButton.prototype:ShowGrid()
|
flickerstreak@1
|
501 self.config.showGrid = true
|
flickerstreak@1
|
502 self:ShowGridTmp()
|
flickerstreak@1
|
503 end
|
flickerstreak@1
|
504
|
flickerstreak@1
|
505 function ReActionButton.prototype:HideGrid()
|
flickerstreak@1
|
506 self.config.showGrid = false
|
flickerstreak@1
|
507 self:HideGridTmp()
|
flickerstreak@1
|
508 end
|
flickerstreak@1
|
509
|
flickerstreak@1
|
510
|
flickerstreak@1
|
511
|
flickerstreak@1
|
512 -- layout & style functions
|
flickerstreak@1
|
513 function ReActionButton.prototype:ApplyLayout()
|
flickerstreak@1
|
514 local f = self.frames
|
flickerstreak@1
|
515
|
flickerstreak@1
|
516 if self.config.keyBindLoc then
|
flickerstreak@1
|
517 local h = f.hotkey
|
flickerstreak@1
|
518 local loc = self.config.keyBindLoc
|
flickerstreak@1
|
519 h:ClearAllPoints()
|
flickerstreak@1
|
520 h:SetPoint(loc,0,0)
|
flickerstreak@1
|
521 local j
|
flickerstreak@1
|
522 if string.match(loc,"LEFT") then
|
flickerstreak@1
|
523 j = "LEFT"
|
flickerstreak@1
|
524 elseif string.match(loc,"RIGHT") then
|
flickerstreak@1
|
525 j = "RIGHT"
|
flickerstreak@1
|
526 else
|
flickerstreak@1
|
527 j = "CENTER"
|
flickerstreak@1
|
528 end
|
flickerstreak@1
|
529 h:SetJustifyH(j)
|
flickerstreak@1
|
530 end
|
flickerstreak@1
|
531
|
flickerstreak@1
|
532 if self.config.stackCountLoc then
|
flickerstreak@1
|
533 local c = f.count
|
flickerstreak@1
|
534 local loc = self.config.stackCountLoc
|
flickerstreak@1
|
535 c:ClearAllPoints()
|
flickerstreak@1
|
536 c:SetPoint(loc,0,0)
|
flickerstreak@1
|
537 local j
|
flickerstreak@1
|
538 if string.match(loc,"LEFT") then
|
flickerstreak@1
|
539 j = "LEFT"
|
flickerstreak@1
|
540 elseif string.match(loc,"RIGHT") then
|
flickerstreak@1
|
541 j = "RIGHT"
|
flickerstreak@1
|
542 else
|
flickerstreak@1
|
543 j = "CENTER"
|
flickerstreak@1
|
544 end
|
flickerstreak@1
|
545 c:SetJustifyH(j)
|
flickerstreak@1
|
546 end
|
flickerstreak@1
|
547
|
flickerstreak@1
|
548 if self.config.showKeyBind then
|
flickerstreak@1
|
549 f.hotkey:Show()
|
flickerstreak@1
|
550 else
|
flickerstreak@1
|
551 f.hotkey:Hide()
|
flickerstreak@1
|
552 end
|
flickerstreak@1
|
553
|
flickerstreak@1
|
554 if self.config.showStackCount then
|
flickerstreak@1
|
555 f.count:Show()
|
flickerstreak@1
|
556 else
|
flickerstreak@1
|
557 f.count:Hide()
|
flickerstreak@1
|
558 end
|
flickerstreak@1
|
559
|
flickerstreak@1
|
560 --[[
|
flickerstreak@1
|
561 if self.config.showNumericCooldown then
|
flickerstreak@1
|
562 f.nCooldown:Show()
|
flickerstreak@1
|
563 else
|
flickerstreak@1
|
564 f.nCooldown:Hide()
|
flickerstreak@1
|
565 end
|
flickerstreak@1
|
566 ]]
|
flickerstreak@1
|
567
|
flickerstreak@1
|
568 if self.config.showMacroName then
|
flickerstreak@1
|
569 f.macro:Show()
|
flickerstreak@1
|
570 else
|
flickerstreak@1
|
571 f.macro:Hide()
|
flickerstreak@1
|
572 end
|
flickerstreak@1
|
573 end
|
flickerstreak@1
|
574
|
flickerstreak@1
|
575 function ReActionButton.prototype:ApplyStyle()
|
flickerstreak@1
|
576 local f = self.frames
|
flickerstreak@1
|
577 -- for now, just a static style
|
flickerstreak@1
|
578 f.hotkey:SetFontObject(NumberFontNormal)
|
flickerstreak@1
|
579 f.count:SetFontObject(NumberFontNormalYellow)
|
flickerstreak@1
|
580 end
|
flickerstreak@1
|
581
|
flickerstreak@1
|
582
|
flickerstreak@1
|
583
|
flickerstreak@1
|
584 -- start/stop flashing
|
flickerstreak@1
|
585 function ReActionButton.prototype:StartFlash()
|
flickerstreak@1
|
586 self.flashing = true
|
flickerstreak@1
|
587 self.flashtime = 0
|
flickerstreak@1
|
588 self:UpdateCheckedState()
|
flickerstreak@1
|
589 end
|
flickerstreak@1
|
590
|
flickerstreak@1
|
591 function ReActionButton.prototype:StopFlash()
|
flickerstreak@1
|
592 self.flashing = false
|
flickerstreak@1
|
593 self.frames.flash:Hide()
|
flickerstreak@1
|
594 self:UpdateCheckedState()
|
flickerstreak@1
|
595 end
|
flickerstreak@1
|
596
|
flickerstreak@1
|
597 function ReActionButton.prototype:IsFlashing()
|
flickerstreak@1
|
598 return self.flashing
|
flickerstreak@1
|
599 end
|
flickerstreak@1
|
600
|
flickerstreak@1
|
601
|
flickerstreak@1
|
602
|
flickerstreak@1
|
603
|
flickerstreak@1
|
604
|
flickerstreak@1
|
605 -- set the tooltip
|
flickerstreak@1
|
606 function ReActionButton.prototype:SetTooltip()
|
flickerstreak@1
|
607 GameTooltip_SetDefaultAnchor(GameTooltip, self.button)
|
flickerstreak@1
|
608 self:UpdateTooltip()
|
flickerstreak@1
|
609 end
|
flickerstreak@1
|
610
|
flickerstreak@1
|
611 function ReActionButton.prototype:ClearTooltip()
|
flickerstreak@1
|
612 tooltipTime = nil
|
flickerstreak@1
|
613 GameTooltip:Hide()
|
flickerstreak@1
|
614 end
|
flickerstreak@1
|
615
|
flickerstreak@1
|
616
|
flickerstreak@1
|
617
|
flickerstreak@1
|
618 -- colorize the hotkey
|
flickerstreak@1
|
619 function ReActionButton.prototype:ColorHotKey()
|
flickerstreak@1
|
620 local action = self:GetActionID()
|
flickerstreak@1
|
621 local c = hotKeyDefaultColor
|
flickerstreak@1
|
622
|
flickerstreak@1
|
623 if action and HasAction(action) then
|
flickerstreak@1
|
624 if IsActionInRange(action) == 0 then
|
flickerstreak@1
|
625 c = hotKeyOutOfRangeColor
|
flickerstreak@1
|
626 elseif self.config.keyBindColorCode then
|
flickerstreak@1
|
627 local modKey = string.match( self.frames.hotkey:GetText() or "", "([ACS])%-")
|
flickerstreak@1
|
628 c = modKey and hotKeyModifierColors[modKey] or c
|
flickerstreak@1
|
629 end
|
flickerstreak@1
|
630 else
|
flickerstreak@1
|
631 c = hotKeyDisabledColor
|
flickerstreak@1
|
632 end
|
flickerstreak@1
|
633
|
flickerstreak@1
|
634 self.frames.hotkey:SetTextColor(c.r, c.g, c.b)
|
flickerstreak@1
|
635 end
|
flickerstreak@1
|
636
|
flickerstreak@1
|
637
|
flickerstreak@1
|
638
|
flickerstreak@1
|
639
|
flickerstreak@1
|
640 -- display update functions
|
flickerstreak@1
|
641 function ReActionButton.prototype:UpdateDisplay()
|
flickerstreak@1
|
642 self:UpdateIcon()
|
flickerstreak@1
|
643 self:UpdateHotkey()
|
flickerstreak@1
|
644 self:UpdateCount()
|
flickerstreak@1
|
645 self:UpdateMacroText()
|
flickerstreak@1
|
646 self:UpdateUsable()
|
flickerstreak@1
|
647 self:UpdateCooldown()
|
flickerstreak@1
|
648 self:UpdateFlash()
|
flickerstreak@1
|
649 self:UpdateEvents()
|
flickerstreak@1
|
650 self:UpdateVisibility()
|
flickerstreak@1
|
651 self:UpdateTooltip()
|
flickerstreak@1
|
652 end
|
flickerstreak@1
|
653
|
flickerstreak@1
|
654 function ReActionButton.prototype:UpdateIcon()
|
flickerstreak@1
|
655 local f = self.frames
|
flickerstreak@1
|
656 local b = self.button
|
flickerstreak@1
|
657
|
flickerstreak@1
|
658 local action = self:GetActionID()
|
flickerstreak@1
|
659 local texture = action and GetActionTexture(action)
|
flickerstreak@1
|
660
|
flickerstreak@1
|
661 if action and texture then
|
flickerstreak@1
|
662 f.icon:SetTexture(texture)
|
flickerstreak@1
|
663 f.icon:Show()
|
flickerstreak@1
|
664 self.rangeTimer = -1
|
flickerstreak@1
|
665 b:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
|
flickerstreak@1
|
666 else
|
flickerstreak@1
|
667 f.icon:Hide()
|
flickerstreak@1
|
668 f.cooldown:Hide()
|
flickerstreak@1
|
669 self.rangeTimer = nil
|
flickerstreak@1
|
670 b:SetNormalTexture("Interface\\Buttons\\UI-Quickslot")
|
flickerstreak@1
|
671 end
|
flickerstreak@1
|
672
|
flickerstreak@1
|
673 self:UpdateCheckedState()
|
flickerstreak@1
|
674
|
flickerstreak@1
|
675 -- Add a green border if action is an equipped item
|
flickerstreak@1
|
676 if action and IsEquippedAction(action) then
|
flickerstreak@1
|
677 local c = equippedActionBorderColor
|
flickerstreak@1
|
678 f.border:SetVertexColor(c.r, c.g, c.b, c.a or 1)
|
flickerstreak@1
|
679 f.border:Show()
|
flickerstreak@1
|
680 else
|
flickerstreak@1
|
681 f.border:Hide()
|
flickerstreak@1
|
682 end
|
flickerstreak@1
|
683 end
|
flickerstreak@1
|
684
|
flickerstreak@1
|
685 function ReActionButton.prototype:UpdateCheckedState()
|
flickerstreak@1
|
686 local action = self:GetActionID()
|
flickerstreak@1
|
687 if action and (IsCurrentAction(action) or IsAutoRepeatAction(action)) then
|
flickerstreak@1
|
688 self.button:SetChecked(1)
|
flickerstreak@1
|
689 else
|
flickerstreak@1
|
690 self.button:SetChecked(0)
|
flickerstreak@1
|
691 end
|
flickerstreak@1
|
692 end
|
flickerstreak@1
|
693
|
flickerstreak@1
|
694
|
flickerstreak@1
|
695 function ReActionButton.prototype:UpdateHotkey()
|
flickerstreak@1
|
696 local action = self:GetActionID()
|
flickerstreak@1
|
697 local b = self.button
|
flickerstreak@1
|
698 local f = self.frames
|
flickerstreak@1
|
699 local key = self:GetKeyBinding()
|
flickerstreak@1
|
700 local txt = GetBindingText(key, "KEY_",1)
|
flickerstreak@1
|
701
|
flickerstreak@1
|
702 if txt then
|
flickerstreak@1
|
703 f.hotkey:SetText(string.upper(txt))
|
flickerstreak@1
|
704 self:ColorHotKey()
|
flickerstreak@1
|
705 else
|
flickerstreak@1
|
706 f.hotkey:SetText("")
|
flickerstreak@1
|
707 end
|
flickerstreak@1
|
708 end
|
flickerstreak@1
|
709
|
flickerstreak@1
|
710 function ReActionButton.prototype:UpdateCount()
|
flickerstreak@1
|
711 local action = self:GetActionID()
|
flickerstreak@1
|
712 if action and (IsConsumableAction(action) or IsStackableAction(action)) then
|
flickerstreak@1
|
713 self.frames.count:SetText(GetActionCount(action))
|
flickerstreak@1
|
714 else
|
flickerstreak@1
|
715 self.frames.count:SetText("")
|
flickerstreak@1
|
716 end
|
flickerstreak@1
|
717 end
|
flickerstreak@1
|
718
|
flickerstreak@1
|
719 function ReActionButton.prototype:UpdateMacroText()
|
flickerstreak@1
|
720 local action = self:GetActionID()
|
flickerstreak@1
|
721 self.frames.macro:SetText(action and GetActionText(action) or "")
|
flickerstreak@1
|
722 end
|
flickerstreak@1
|
723
|
flickerstreak@1
|
724 function ReActionButton.prototype:UpdateUsable()
|
flickerstreak@1
|
725 local f = self.frames
|
flickerstreak@1
|
726 local action = self:GetActionID()
|
flickerstreak@1
|
727 local isUsable, notEnoughMana
|
flickerstreak@1
|
728 if action then
|
flickerstreak@1
|
729 isUsable, notEnoughMana = IsUsableAction(action)
|
flickerstreak@1
|
730 end
|
flickerstreak@1
|
731 if isUsable then
|
flickerstreak@1
|
732 local c = actionUsableColor
|
flickerstreak@1
|
733 if IsActionInRange(action) == 0 then
|
flickerstreak@1
|
734 c = actionOutOfRangeColor
|
flickerstreak@1
|
735 else
|
flickerstreak@1
|
736 f.normalTexture:SetVertexColor(c.r, c.g, c.b, c.a)
|
flickerstreak@1
|
737 end
|
flickerstreak@1
|
738 f.icon:SetVertexColor(c.r, c.g, c.b, c.a)
|
flickerstreak@1
|
739 elseif notEnoughMana then
|
flickerstreak@1
|
740 local c = actionNotEnoughManaColor
|
flickerstreak@1
|
741 f.icon:SetVertexColor(c.r, c.g, c.b, c.a)
|
flickerstreak@1
|
742 f.normalTexture:SetVertexColor(c.r, c.g, c.b, c.a)
|
flickerstreak@1
|
743 else
|
flickerstreak@1
|
744 local c = actionNotUsableColor
|
flickerstreak@1
|
745 f.icon:SetVertexColor(c.r, c.g, c.b, c.a)
|
flickerstreak@1
|
746 f.normalTexture:SetVertexColor(1.0, 1.0, 1.0)
|
flickerstreak@1
|
747 end
|
flickerstreak@1
|
748 end
|
flickerstreak@1
|
749
|
flickerstreak@1
|
750 function ReActionButton.prototype:UpdateCooldown()
|
flickerstreak@1
|
751 local action = self:GetActionID()
|
flickerstreak@1
|
752 if action then
|
flickerstreak@1
|
753 local start, duration, enable = GetActionCooldown(self:GetActionID())
|
flickerstreak@1
|
754 CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enable)
|
flickerstreak@1
|
755 -- do numeric cooldown stuff here
|
flickerstreak@1
|
756 end
|
flickerstreak@1
|
757 end
|
flickerstreak@1
|
758
|
flickerstreak@1
|
759 function ReActionButton.prototype:UpdateFlash()
|
flickerstreak@1
|
760 local b = self.button
|
flickerstreak@1
|
761 local action = self:GetActionID()
|
flickerstreak@1
|
762 if action and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action)) then
|
flickerstreak@1
|
763 self:StartFlash()
|
flickerstreak@1
|
764 else
|
flickerstreak@1
|
765 self:StopFlash()
|
flickerstreak@1
|
766 end
|
flickerstreak@1
|
767 end
|
flickerstreak@1
|
768
|
flickerstreak@1
|
769 function ReActionButton.prototype:UpdateVisibility()
|
flickerstreak@1
|
770 local action = self:GetActionID()
|
flickerstreak@1
|
771 local b = self.button
|
flickerstreak@1
|
772
|
flickerstreak@1
|
773 if b:GetAttribute("statehidden") then
|
flickerstreak@1
|
774 b:Hide()
|
flickerstreak@1
|
775 elseif action and HasAction(action) then
|
flickerstreak@1
|
776 b:GetNormalTexture():SetAlpha(1.0)
|
flickerstreak@1
|
777 b:Show()
|
flickerstreak@1
|
778 elseif self.showGrid > 0 then
|
flickerstreak@1
|
779 b:GetNormalTexture():SetAlpha(0.5)
|
flickerstreak@1
|
780 self.frames.cooldown:Hide()
|
flickerstreak@1
|
781 b:Show()
|
flickerstreak@1
|
782 else
|
flickerstreak@1
|
783 b:Hide()
|
flickerstreak@1
|
784 end
|
flickerstreak@1
|
785 end
|
flickerstreak@1
|
786
|
flickerstreak@1
|
787 function ReActionButton.prototype:UpdateEvents()
|
flickerstreak@1
|
788 local action = self:GetActionID()
|
flickerstreak@1
|
789 if action and HasAction(action) then
|
flickerstreak@1
|
790 self:RegisterActionEvents()
|
flickerstreak@1
|
791 elseif self.actionEventsRegistered then
|
flickerstreak@1
|
792 self:UnregisterActionEvents()
|
flickerstreak@1
|
793 end
|
flickerstreak@1
|
794 end
|
flickerstreak@1
|
795
|
flickerstreak@1
|
796 function ReActionButton.prototype:UpdateTooltip()
|
flickerstreak@1
|
797 local action = self:GetActionID()
|
flickerstreak@1
|
798 if action and GameTooltip:SetAction(action) then
|
flickerstreak@1
|
799 self.tooltipTime = TOOLTIP_UPDATE_TIME
|
flickerstreak@1
|
800 else
|
flickerstreak@1
|
801 self.tooltipTime = nil
|
flickerstreak@1
|
802 end
|
flickerstreak@1
|
803 end
|
flickerstreak@1
|
804
|
flickerstreak@1
|
805
|
flickerstreak@1
|
806
|