flickerstreak@175
|
1 local addonName, addonTable = ...
|
flickerstreak@175
|
2 local ReAction = addonTable.ReAction
|
flickerstreak@122
|
3 local L = ReAction.L
|
flickerstreak@122
|
4 local _G = _G
|
flickerstreak@122
|
5 local CreateFrame = CreateFrame
|
flickerstreak@122
|
6 local format = string.format
|
flickerstreak@122
|
7 local IsUsableAction = IsUsableAction
|
flickerstreak@122
|
8 local IsEquippedAction = IsEquippedAction
|
flickerstreak@122
|
9 local IsConsumableAction = IsConsumableAction
|
flickerstreak@122
|
10 local IsStackableAction = IsStackableAction
|
flickerstreak@122
|
11 local GetActionText = GetActionText
|
flickerstreak@122
|
12 local GetCVar = GetCVar
|
flickerstreak@122
|
13 local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor
|
flickerstreak@122
|
14 local IsCurrentAction = IsCurrentAction
|
flickerstreak@122
|
15 local IsAutoRepeatAction = IsAutoRepeatAction
|
flickerstreak@122
|
16 local IsUsableAction = IsUsableAction
|
flickerstreak@122
|
17 local IsAttackAction = IsAttackAction
|
flickerstreak@122
|
18 local CooldownFrame_SetTimer = CooldownFrame_SetTimer
|
flickerstreak@122
|
19 local GetActionCooldown = GetActionCooldown
|
flickerstreak@122
|
20 local GetActionTexture = GetActionTexture
|
flickerstreak@122
|
21 local ATTACK_BUTTON_FLASH_TIME = ATTACK_BUTTON_FLASH_TIME
|
flickerstreak@122
|
22 local TOOLTIP_UPDATE_TIME = TOOLTIP_UPDATE_TIME
|
flickerstreak@122
|
23 local IsActionInRange = IsActionInRange
|
flickerstreak@122
|
24 local InCombatLockdown = InCombatLockdown
|
flickerstreak@122
|
25 local HasAction = HasAction
|
flickerstreak@122
|
26
|
flickerstreak@122
|
27 --
|
flickerstreak@122
|
28 -- Secure snippets
|
flickerstreak@122
|
29 -- These are run within the context of the bar's sandbox, as the
|
flickerstreak@122
|
30 -- buttons themselves do not have their own sandbox.
|
flickerstreak@122
|
31 --
|
flickerstreak@122
|
32 local _onstate_mc = -- function(self, stateid, newstate)
|
flickerstreak@122
|
33 [[
|
flickerstreak@122
|
34 local oldMcVehicleState = mcVehicleState
|
flickerstreak@122
|
35 mcVehicleState = newstate
|
flickerstreak@122
|
36 control:ChildUpdate()
|
flickerstreak@122
|
37 if oldMcVehicleState == "vehicle" or mcVehicleState == "vehicle" then
|
flickerstreak@122
|
38 control:ChildUpdate("vehicle")
|
flickerstreak@122
|
39 end
|
flickerstreak@122
|
40 ]]
|
flickerstreak@122
|
41
|
flickerstreak@122
|
42 local _childupdate = -- function(self, snippetid, message)
|
flickerstreak@122
|
43 [[
|
flickerstreak@122
|
44 local action = nil
|
flickerstreak@122
|
45 if (doVehicle and mcVehicleState == "vehicle") or
|
flickerstreak@122
|
46 (doMindControl and mcVehicleState == "mc") then
|
flickerstreak@122
|
47 local idx = self:GetAttribute("bar-idx")
|
flickerstreak@145
|
48 local maxN = (doVehicle and mcVehicleState == "vehicle") and 7 or 12
|
flickerstreak@145
|
49 if idx and idx <= maxN then
|
flickerstreak@122
|
50 action = 120 + idx
|
flickerstreak@122
|
51 else
|
flickerstreak@122
|
52 action = 0
|
flickerstreak@122
|
53 end
|
flickerstreak@155
|
54 elseif state and settings[state] and settings[state].page then
|
flickerstreak@155
|
55 action = self:GetAttribute("action-"..settings[state].page)
|
flickerstreak@138
|
56 end
|
flickerstreak@138
|
57 if action == nil then
|
flickerstreak@122
|
58 action = self:GetAttribute("default-action")
|
flickerstreak@122
|
59 end
|
flickerstreak@122
|
60
|
flickerstreak@122
|
61 self:SetAttribute("action",action)
|
flickerstreak@122
|
62
|
flickerstreak@128
|
63 if not self:GetAttribute("showgrid") then
|
flickerstreak@128
|
64 local tempShow = self:GetAttribute("showgrid-temp")
|
flickerstreak@128
|
65 local evtShow = self:GetAttribute("showgrid-event")
|
flickerstreak@128
|
66 if tempShow then tempShow = (tempShow > 0) end
|
flickerstreak@128
|
67 if evtShow then evtShow = (evtShow > 0) end
|
flickerstreak@128
|
68
|
flickerstreak@170
|
69 if tempShow or evtShow or HasAction(action) then
|
flickerstreak@128
|
70 self:Show()
|
flickerstreak@128
|
71 else
|
flickerstreak@128
|
72 self:Hide()
|
flickerstreak@128
|
73 end
|
flickerstreak@122
|
74 end
|
flickerstreak@122
|
75 ]]
|
flickerstreak@122
|
76
|
flickerstreak@122
|
77 local _childupdate_vehicleExit = -- function(self, snippetid, message)
|
flickerstreak@122
|
78 [[
|
flickerstreak@122
|
79 local show = (mcVehicleState == "vehicle")
|
flickerstreak@124
|
80 if show and doVehicle then
|
flickerstreak@122
|
81 self:SetAttribute("type","macro")
|
flickerstreak@122
|
82 self:Show()
|
flickerstreak@122
|
83 else
|
flickerstreak@122
|
84 self:SetAttribute("type","action")
|
flickerstreak@122
|
85 end
|
flickerstreak@122
|
86 control:CallMethod("ShowVehicleExit",show)
|
flickerstreak@122
|
87 ]]
|
flickerstreak@122
|
88
|
flickerstreak@122
|
89 local _childupdate_showgrid = -- function(self, snippetid, message)
|
flickerstreak@122
|
90 [[
|
flickerstreak@186
|
91 showgrid_event = message
|
flickerstreak@128
|
92 self:SetAttribute("showgrid-event",message)
|
flickerstreak@128
|
93 if not self:GetAttribute("showgrid") then
|
flickerstreak@128
|
94 local count = message + (self:GetAttribute("showgrid-temp") or 0)
|
flickerstreak@128
|
95 if count <= 0 then
|
flickerstreak@128
|
96 local action = self:GetAttribute("action")
|
flickerstreak@186
|
97 -- note that HasAction is not updated on the target of a drag until after ACTIONBAR_HIDEGRID
|
flickerstreak@186
|
98 -- so, we set a flag for this button in pre-click/receive-drag and check for it here
|
flickerstreak@186
|
99 if HasAction(action) or self:GetAttribute("showgrid-clicked") then
|
flickerstreak@186
|
100 if not self:IsShown() then
|
flickerstreak@186
|
101 self:Show()
|
flickerstreak@186
|
102 end
|
flickerstreak@186
|
103 self:SetAttribute("showgrid-clicked",false)
|
flickerstreak@186
|
104 else
|
flickerstreak@186
|
105 if self:IsShown() then
|
flickerstreak@186
|
106 self:Hide()
|
flickerstreak@186
|
107 end
|
flickerstreak@128
|
108 end
|
flickerstreak@128
|
109 else
|
flickerstreak@122
|
110 self:Show()
|
flickerstreak@122
|
111 end
|
flickerstreak@122
|
112 end
|
flickerstreak@122
|
113 ]]
|
flickerstreak@122
|
114
|
flickerstreak@122
|
115 local _onDragStart = -- function(self, button, kind, value, ...)
|
flickerstreak@122
|
116 [[
|
flickerstreak@122
|
117 if lockButtons and (PlayerInCombat() or not lockButtonsCombat) and not IsModifiedClick("PICKUPACTION") then
|
flickerstreak@122
|
118 return kind, value, ...
|
flickerstreak@122
|
119 else
|
flickerstreak@122
|
120 return "action", self:GetAttribute("action")
|
flickerstreak@122
|
121 end
|
flickerstreak@122
|
122 ]]
|
flickerstreak@122
|
123
|
flickerstreak@122
|
124 local _onReceiveDrag = -- function(self, button, kind, value, ...)
|
flickerstreak@122
|
125 [[
|
Flick@238
|
126 if kind ~= "spell" and kind ~= "item" and kind ~= "macro" and kind ~= "flyout" then
|
flickerstreak@129
|
127 return kind, value, ...
|
flickerstreak@170
|
128 else
|
flickerstreak@186
|
129 if showgrid_event and showgrid_event > 0 then
|
flickerstreak@186
|
130 self:SetAttribute("showgrid-clicked",true)
|
flickerstreak@186
|
131 end
|
flickerstreak@170
|
132 return "action", self:GetAttribute("action")
|
flickerstreak@122
|
133 end
|
flickerstreak@122
|
134 ]]
|
flickerstreak@122
|
135
|
flickerstreak@186
|
136 local _onClick = -- function(self, button, down)
|
flickerstreak@186
|
137 [[
|
flickerstreak@186
|
138 if showgrid_event and showgrid_event > 0 then
|
flickerstreak@186
|
139 self:SetAttribute("showgrid-clicked",true)
|
flickerstreak@186
|
140 end
|
flickerstreak@186
|
141 return button
|
flickerstreak@186
|
142 ]]
|
flickerstreak@186
|
143
|
flickerstreak@122
|
144 --
|
flickerstreak@122
|
145 -- private
|
flickerstreak@122
|
146 --
|
flickerstreak@122
|
147 local eventList = {
|
flickerstreak@122
|
148 "PLAYER_ENTERING_WORLD",
|
flickerstreak@122
|
149 "ACTIONBAR_PAGE_CHANGED",
|
flickerstreak@122
|
150 "ACTIONBAR_SLOT_CHANGED",
|
flickerstreak@122
|
151 "UPDATE_BINDINGS",
|
flickerstreak@122
|
152 "ACTIONBAR_UPDATE_STATE",
|
flickerstreak@122
|
153 "ACTIONBAR_UPDATE_USABLE",
|
flickerstreak@122
|
154 "ACTIONBAR_UPDATE_COOLDOWN",
|
flickerstreak@165
|
155 "UNIT_INVENTORY_CHANGED",
|
flickerstreak@165
|
156 "LEARNED_SPELL_IN_TAB",
|
flickerstreak@122
|
157 "UPDATE_INVENTORY_ALERTS",
|
flickerstreak@122
|
158 "PLAYER_TARGET_CHANGED",
|
flickerstreak@122
|
159 "TRADE_SKILL_SHOW",
|
flickerstreak@122
|
160 "TRADE_SKILL_CLOSE",
|
flickerstreak@122
|
161 "PLAYER_ENTER_COMBAT",
|
flickerstreak@122
|
162 "PLAYER_LEAVE_COMBAT",
|
flickerstreak@122
|
163 "START_AUTOREPEAT_SPELL",
|
flickerstreak@122
|
164 "STOP_AUTOREPEAT_SPELL",
|
flickerstreak@122
|
165 "UNIT_ENTERED_VEHICLE",
|
flickerstreak@122
|
166 "UNIT_EXITED_VEHICLE",
|
flickerstreak@122
|
167 "COMPANION_UPDATE",
|
flickerstreak@122
|
168 }
|
flickerstreak@122
|
169
|
flickerstreak@122
|
170 --
|
flickerstreak@122
|
171 -- Action Button class
|
flickerstreak@122
|
172 --
|
flickerstreak@218
|
173 local buttonTypeID = "Action"
|
flickerstreak@122
|
174 local Super = ReAction.Button
|
flickerstreak@218
|
175 local Action = setmetatable(
|
flickerstreak@218
|
176 {
|
flickerstreak@218
|
177 defaultBarConfig = {
|
flickerstreak@218
|
178 type = buttonTypeID,
|
flickerstreak@218
|
179 btnWidth = 36,
|
flickerstreak@218
|
180 btnHeight = 36,
|
flickerstreak@218
|
181 btnRows = 1,
|
flickerstreak@218
|
182 btnColumns = 12,
|
flickerstreak@220
|
183 spacing = 3,
|
flickerstreak@220
|
184 buttons = { },
|
flickerstreak@218
|
185 },
|
flickerstreak@218
|
186
|
Flick@231
|
187 barType = L["Action Bar"],
|
Flick@231
|
188 buttonTypeID = buttonTypeID
|
flickerstreak@218
|
189 },
|
flickerstreak@218
|
190 { __index = Super } )
|
flickerstreak@223
|
191
|
flickerstreak@122
|
192 ReAction.Button.Action = Action
|
flickerstreak@223
|
193 ReAction:RegisterBarType(Action, true)
|
flickerstreak@122
|
194
|
Flick@234
|
195 function Action:New( config, bar, idx, idHint )
|
flickerstreak@123
|
196 local name = format("ReAction_%s_Action_%d",bar:GetName(),idx)
|
flickerstreak@123
|
197
|
Flick@234
|
198 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
|
Flick@234
|
199 self.barConfig = bar:GetConfig()
|
flickerstreak@122
|
200
|
flickerstreak@122
|
201 local f = self:GetFrame()
|
flickerstreak@122
|
202 local barFrame = bar:GetFrame()
|
flickerstreak@122
|
203
|
flickerstreak@122
|
204 self.rangeTimer = TOOLTIP_UPDATE_TIME
|
flickerstreak@122
|
205
|
flickerstreak@122
|
206 -- set up the base action ID
|
flickerstreak@122
|
207 self:SetActionIDPool("action",120)
|
flickerstreak@122
|
208 config.actionID = self:AcquireActionID(config.actionID, idHint)
|
flickerstreak@122
|
209 self.nPages = 1
|
flickerstreak@122
|
210
|
flickerstreak@122
|
211 -- attribute setup
|
flickerstreak@122
|
212 f:SetAttribute("type","action")
|
flickerstreak@122
|
213 f:SetAttribute("checkselfcast", true)
|
flickerstreak@122
|
214 f:SetAttribute("checkfocuscast", true)
|
flickerstreak@122
|
215 f:SetAttribute("action", config.actionID)
|
flickerstreak@122
|
216 f:SetAttribute("default-action", config.actionID)
|
flickerstreak@128
|
217 f:SetAttribute("bar-idx",idx)
|
flickerstreak@122
|
218 f:SetAttribute("showgrid-temp",0)
|
flickerstreak@128
|
219 f:SetAttribute("showgrid-event",0)
|
flickerstreak@128
|
220 f:SetAttribute("showgrid",not self:GetBarConfig().hideEmpty)
|
flickerstreak@128
|
221
|
flickerstreak@122
|
222 -- non secure scripts
|
flickerstreak@122
|
223 f:SetScript("OnEvent", function(frame, ...) self:OnEvent(...) end)
|
flickerstreak@122
|
224 f:SetScript("OnEnter", function(frame) self:OnEnter() end)
|
flickerstreak@122
|
225 f:SetScript("OnLeave", function(frame) self:OnLeave() end)
|
flickerstreak@122
|
226 f:SetScript("OnAttributeChanged", function(frame, attr, value) self:OnAttributeChanged(attr, value) end)
|
flickerstreak@122
|
227 f:SetScript("PostClick", function(frame, ...) self:PostClick(...) end)
|
flickerstreak@122
|
228 f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end)
|
flickerstreak@122
|
229 f:SetScript("OnDragStart", function(frame) self:OnDragStart() end)
|
flickerstreak@123
|
230 f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end)
|
flickerstreak@122
|
231
|
flickerstreak@122
|
232 -- event registration
|
flickerstreak@124
|
233 f:EnableMouse(true)
|
flickerstreak@122
|
234 f:RegisterForDrag("LeftButton", "RightButton")
|
flickerstreak@122
|
235 f:RegisterForClicks("AnyUp")
|
flickerstreak@122
|
236 for _, evt in pairs(eventList) do
|
flickerstreak@122
|
237 f:RegisterEvent(evt)
|
flickerstreak@122
|
238 end
|
flickerstreak@122
|
239
|
Flick@238
|
240 f.action = config.actionID -- need this to support silly ActionButton_UpdateFlyout. Should not taint anything anymore.
|
Flick@238
|
241
|
flickerstreak@138
|
242 -- secure handlers
|
flickerstreak@138
|
243 f:SetAttribute("_childupdate", _childupdate)
|
flickerstreak@138
|
244 f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid)
|
flickerstreak@138
|
245 barFrame:WrapScript(f, "OnDragStart", _onDragStart)
|
flickerstreak@138
|
246 barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag)
|
flickerstreak@186
|
247 barFrame:WrapScript(f, "OnClick", _onClick)
|
flickerstreak@123
|
248
|
flickerstreak@140
|
249 -- attach to skinner
|
flickerstreak@140
|
250 bar:SkinButton(self)
|
flickerstreak@140
|
251
|
flickerstreak@140
|
252 -- initial display
|
flickerstreak@140
|
253 if ReAction:GetConfigMode() then
|
flickerstreak@140
|
254 self:ShowGridTemp(true)
|
flickerstreak@140
|
255 end
|
flickerstreak@140
|
256
|
flickerstreak@140
|
257 self:Refresh()
|
flickerstreak@140
|
258
|
flickerstreak@123
|
259 return self
|
flickerstreak@122
|
260 end
|
flickerstreak@122
|
261
|
flickerstreak@122
|
262 function Action:Destroy()
|
flickerstreak@122
|
263 local f = self:GetFrame()
|
flickerstreak@128
|
264 local c = self:GetConfig()
|
flickerstreak@122
|
265
|
flickerstreak@132
|
266 f:SetAttribute("_childupdate-vehicle",nil)
|
flickerstreak@145
|
267 f:SetAttribute("action",c.actionID) -- so that Super.Destroy releases the right one
|
flickerstreak@122
|
268
|
flickerstreak@139
|
269 if c.pageactions and #c.pageactions > 1 then
|
flickerstreak@139
|
270 for i = 2, #c.pageactions do
|
flickerstreak@132
|
271 self:ReleaseActionID(c.pageactions[i])
|
flickerstreak@122
|
272 self:ReleaseActionID(id)
|
flickerstreak@122
|
273 end
|
flickerstreak@122
|
274 end
|
flickerstreak@122
|
275
|
flickerstreak@128
|
276 Super.Destroy(self)
|
flickerstreak@122
|
277 end
|
flickerstreak@122
|
278
|
flickerstreak@129
|
279 function Action:GetBarConfig()
|
flickerstreak@129
|
280 -- this is the per-bar Action module config structure,
|
flickerstreak@129
|
281 -- not the config structure of the bar itself
|
flickerstreak@129
|
282 return self.barConfig
|
flickerstreak@129
|
283 end
|
flickerstreak@129
|
284
|
flickerstreak@122
|
285 function Action:Refresh()
|
flickerstreak@129
|
286 Super.Refresh(self)
|
flickerstreak@122
|
287 self:RefreshPages()
|
flickerstreak@124
|
288 self:InstallVehicle()
|
flickerstreak@128
|
289 self:ShowGrid(not self:GetBarConfig().hideEmpty)
|
flickerstreak@122
|
290 self:UpdateAction()
|
flickerstreak@122
|
291 end
|
flickerstreak@122
|
292
|
flickerstreak@124
|
293 function Action:InstallVehicle()
|
flickerstreak@145
|
294 local f = self:GetFrame()
|
flickerstreak@128
|
295 if self.idx == 7 and self:GetBarConfig().vehicle then
|
flickerstreak@159
|
296 if not self.vehicleInstalled then
|
flickerstreak@159
|
297 self.vehicleInstalled = true
|
flickerstreak@159
|
298 -- install vehicle-exit button on 7th button (only)
|
flickerstreak@159
|
299 f:SetAttribute("_childupdate-vehicle", _childupdate_vehicleExit)
|
flickerstreak@159
|
300 f:SetAttribute("macrotext","/run VehicleExit()")
|
flickerstreak@159
|
301 self:GetBar():GetFrame().ShowVehicleExit = function(bar,show)
|
flickerstreak@159
|
302 self:ShowVehicleExit(show)
|
flickerstreak@159
|
303 end
|
flickerstreak@124
|
304 end
|
flickerstreak@159
|
305 -- setscale blows away tex coords
|
flickerstreak@159
|
306 self:UpdateIcon()
|
flickerstreak@159
|
307 elseif self.vehicleInstalled then
|
flickerstreak@159
|
308 self.vehicleInstalled = false
|
flickerstreak@145
|
309 f:SetAttribute("_childupdate-vehicle",nil)
|
flickerstreak@145
|
310 f:SetAttribute("macrotext",nil)
|
flickerstreak@128
|
311 end
|
flickerstreak@128
|
312 end
|
flickerstreak@128
|
313
|
flickerstreak@128
|
314 function Action:ShowGrid( show )
|
flickerstreak@128
|
315 if not InCombatLockdown() then
|
flickerstreak@128
|
316 self.frame:SetAttribute("showgrid", show)
|
flickerstreak@128
|
317 self:UpdateShowGrid()
|
flickerstreak@128
|
318 end
|
flickerstreak@128
|
319 end
|
flickerstreak@128
|
320
|
flickerstreak@128
|
321 function Action:ShowGridTemp( show )
|
flickerstreak@128
|
322 -- This function only modifies the show-grid when out
|
flickerstreak@128
|
323 -- of combat, and is ignored by the secure handler. Use
|
flickerstreak@128
|
324 -- it for configuration modes.
|
flickerstreak@128
|
325 if not InCombatLockdown() then
|
flickerstreak@128
|
326 local count = self.showGridTempCount or 0
|
flickerstreak@128
|
327 if show then
|
flickerstreak@128
|
328 count = count + 1
|
flickerstreak@128
|
329 else
|
flickerstreak@128
|
330 count = count - 1
|
flickerstreak@128
|
331 end
|
flickerstreak@128
|
332 if count < 0 then count = 0 end
|
flickerstreak@128
|
333 self.showGridTempCount = count
|
flickerstreak@128
|
334 self:GetFrame():SetAttribute("showgrid-temp",count)
|
flickerstreak@128
|
335 self:UpdateShowGrid()
|
flickerstreak@124
|
336 end
|
flickerstreak@124
|
337 end
|
flickerstreak@124
|
338
|
flickerstreak@122
|
339 function Action:UpdateAll()
|
flickerstreak@122
|
340 self:UpdateActionIDLabel(ReAction:GetConfigMode())
|
flickerstreak@122
|
341 self:UpdateHotkey()
|
flickerstreak@122
|
342 self:UpdateShowGrid()
|
flickerstreak@122
|
343 self:UpdateIcon()
|
flickerstreak@122
|
344 self:UpdateBorder()
|
flickerstreak@122
|
345 self:UpdateMacroText()
|
flickerstreak@122
|
346 self:UpdateCount()
|
flickerstreak@122
|
347 self:UpdateTooltip()
|
flickerstreak@122
|
348 self:UpdateCheckedState()
|
flickerstreak@122
|
349 self:UpdateUsable()
|
flickerstreak@122
|
350 self:UpdateCooldown()
|
flickerstreak@122
|
351 self:UpdateFlash()
|
flickerstreak@122
|
352 end
|
flickerstreak@122
|
353
|
flickerstreak@122
|
354 function Action:UpdateAction()
|
flickerstreak@122
|
355 local action = self:GetActionID()
|
flickerstreak@122
|
356 if action ~= self.actionID then
|
flickerstreak@122
|
357 self.actionID = action
|
flickerstreak@122
|
358 self:UpdateAll()
|
flickerstreak@122
|
359 end
|
flickerstreak@122
|
360 end
|
flickerstreak@122
|
361
|
flickerstreak@122
|
362 function Action:UpdateShowGrid()
|
flickerstreak@170
|
363 if not InCombatLockdown() then
|
flickerstreak@128
|
364 local f = self:GetFrame()
|
flickerstreak@128
|
365 local count = (f:GetAttribute("showgrid-event") or 0) +
|
flickerstreak@128
|
366 (self.showGridTempCount or 0) +
|
flickerstreak@128
|
367 (f:GetAttribute("showgrid") and 1 or 0)
|
flickerstreak@128
|
368
|
flickerstreak@128
|
369 if count <= 0 and not HasAction(self.actionID) then
|
flickerstreak@128
|
370 if f:IsShown() then
|
flickerstreak@128
|
371 f:Hide()
|
flickerstreak@128
|
372 end
|
flickerstreak@128
|
373 elseif not f:IsShown() then
|
flickerstreak@122
|
374 f:Show()
|
flickerstreak@122
|
375 end
|
flickerstreak@122
|
376 end
|
flickerstreak@122
|
377 end
|
flickerstreak@122
|
378
|
flickerstreak@122
|
379 function Action:UpdateIcon()
|
flickerstreak@161
|
380 local texture, tLeft, tRight, tTop, tBottom = self:GetIconTexture()
|
flickerstreak@122
|
381 local icon = self.frames.icon
|
flickerstreak@122
|
382 local hotkey = self.frames.hotkey
|
flickerstreak@122
|
383 local f = self:GetFrame()
|
flickerstreak@145
|
384
|
flickerstreak@145
|
385 if self.vehicleExitMode then
|
flickerstreak@145
|
386 texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up"
|
flickerstreak@145
|
387 icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375)
|
flickerstreak@159
|
388 icon:SetVertexColor(1,1,1)
|
flickerstreak@145
|
389 else
|
flickerstreak@145
|
390 icon:SetTexCoord(0,1,0,1)
|
flickerstreak@145
|
391 end
|
flickerstreak@145
|
392
|
flickerstreak@122
|
393 if texture then
|
flickerstreak@122
|
394 icon:SetTexture(texture)
|
flickerstreak@161
|
395 if tLeft then
|
flickerstreak@161
|
396 icon:SetTexCoord(tLeft,tRight,tTop,tBottom)
|
flickerstreak@161
|
397 end
|
flickerstreak@122
|
398 icon:Show()
|
flickerstreak@122
|
399 self.rangeTimer = -1
|
flickerstreak@122
|
400 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
|
flickerstreak@122
|
401 else
|
flickerstreak@122
|
402 icon:Hide()
|
flickerstreak@122
|
403 self.frames.cooldown:Hide()
|
flickerstreak@122
|
404 self.rangeTimer = nil
|
flickerstreak@159
|
405 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot")
|
flickerstreak@122
|
406 end
|
flickerstreak@122
|
407 end
|
flickerstreak@122
|
408
|
flickerstreak@161
|
409 function Action:GetIconTexture()
|
flickerstreak@161
|
410 return GetActionTexture(self.actionID)
|
flickerstreak@161
|
411 end
|
flickerstreak@161
|
412
|
flickerstreak@122
|
413 function Action:UpdateBorder()
|
flickerstreak@122
|
414 local action = self.actionID
|
flickerstreak@122
|
415 if ReAction:GetKeybindMode() then
|
flickerstreak@122
|
416 self:UpdateKeybindModeDisplay(true)
|
flickerstreak@122
|
417 elseif IsEquippedAction(action) then
|
flickerstreak@122
|
418 self.frames.border:SetVertexColor(0, 1.0, 0, 0.35)
|
flickerstreak@122
|
419 self.frames.border:Show()
|
flickerstreak@122
|
420 else
|
flickerstreak@122
|
421 self.frames.border:Hide()
|
flickerstreak@122
|
422 end
|
flickerstreak@122
|
423 end
|
flickerstreak@122
|
424
|
flickerstreak@122
|
425 function Action:UpdateMacroText()
|
flickerstreak@122
|
426 local action = self.actionID
|
flickerstreak@122
|
427 if not IsConsumableAction(action) and not IsStackableAction(action) then
|
flickerstreak@122
|
428 self.frames.name:SetText(GetActionText(action))
|
flickerstreak@122
|
429 else
|
flickerstreak@122
|
430 self.frames.name:SetText("")
|
flickerstreak@122
|
431 end
|
flickerstreak@122
|
432 end
|
flickerstreak@122
|
433
|
flickerstreak@122
|
434 function Action:UpdateCount()
|
flickerstreak@122
|
435 local action = self.actionID
|
flickerstreak@122
|
436 if IsConsumableAction(action) or IsStackableAction(action) then
|
flickerstreak@122
|
437 self.frames.count:SetText(GetActionCount(action))
|
flickerstreak@122
|
438 else
|
flickerstreak@122
|
439 self.frames.count:SetText("")
|
flickerstreak@122
|
440 end
|
flickerstreak@122
|
441 end
|
flickerstreak@122
|
442
|
flickerstreak@122
|
443 function Action:UpdateTooltip()
|
flickerstreak@122
|
444 local f = self:GetFrame()
|
flickerstreak@122
|
445 if GameTooltip:GetOwner() == f then
|
flickerstreak@122
|
446 self:SetTooltip()
|
flickerstreak@122
|
447 end
|
flickerstreak@122
|
448 end
|
flickerstreak@122
|
449
|
flickerstreak@122
|
450 function Action:SetTooltip()
|
flickerstreak@122
|
451 local f = self:GetFrame()
|
flickerstreak@122
|
452 if GetCVar("UberTooltips") == "1" then
|
flickerstreak@122
|
453 GameTooltip_SetDefaultAnchor(GameTooltip, f)
|
flickerstreak@122
|
454 else
|
flickerstreak@165
|
455 GameTooltip:SetOwner(f,"ANCHOR_RIGHT")
|
flickerstreak@122
|
456 end
|
flickerstreak@122
|
457 GameTooltip:SetAction(self.actionID)
|
flickerstreak@122
|
458 end
|
flickerstreak@122
|
459
|
flickerstreak@122
|
460 function Action:UpdateCheckedState()
|
flickerstreak@122
|
461 local action = self.actionID
|
flickerstreak@122
|
462 if IsCurrentAction(action) or IsAutoRepeatAction(action) then
|
flickerstreak@122
|
463 self:GetFrame():SetChecked(1)
|
flickerstreak@122
|
464 else
|
flickerstreak@122
|
465 self:GetFrame():SetChecked(0)
|
flickerstreak@122
|
466 end
|
flickerstreak@122
|
467 end
|
flickerstreak@122
|
468
|
flickerstreak@122
|
469 function Action:UpdateUsable()
|
flickerstreak@161
|
470 local isUsable, notEnoughMana = self:GetUsable()
|
flickerstreak@161
|
471 local noRange = self:GetInRange()
|
flickerstreak@159
|
472
|
flickerstreak@159
|
473 isUsable = self.vehicleExitMode or (isUsable and not noRange)
|
flickerstreak@159
|
474
|
flickerstreak@159
|
475 if isUsable then
|
flickerstreak@159
|
476 if self.usableStatus ~= "usable" then
|
flickerstreak@159
|
477 self.frames.icon:SetVertexColor(1.0, 1.0, 1.0)
|
flickerstreak@159
|
478 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0)
|
flickerstreak@159
|
479 self.usableStatus = "usable"
|
flickerstreak@159
|
480 end
|
flickerstreak@159
|
481 elseif noRange then
|
flickerstreak@159
|
482 if self.usableStatus ~= "norange" then
|
flickerstreak@159
|
483 self.frames.icon:SetVertexColor(1.0,0.1,0.1)
|
flickerstreak@159
|
484 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0)
|
flickerstreak@159
|
485 self.usableStatus = "norange"
|
flickerstreak@159
|
486 end
|
flickerstreak@122
|
487 elseif notEnoughMana then
|
flickerstreak@159
|
488 if self.usableStatus ~= "oom" then
|
flickerstreak@159
|
489 self.frames.icon:SetVertexColor(0.5, 0.5, 1.0)
|
flickerstreak@159
|
490 self.frames.normalTexture:SetVertexColor(0.5, 0.5, 1.0)
|
flickerstreak@159
|
491 self.usableStatus = "oom"
|
flickerstreak@159
|
492 end
|
flickerstreak@122
|
493 else
|
flickerstreak@159
|
494 if self.usableStatus ~= "unusable" then
|
flickerstreak@159
|
495 self.frames.icon:SetVertexColor(0.4, 0.4, 0.4)
|
flickerstreak@159
|
496 self.frames.normalTexture:SetVertexColor(1.0, 1.0, 1.0)
|
flickerstreak@159
|
497 self.usableStatus = "unusable"
|
flickerstreak@159
|
498 end
|
flickerstreak@122
|
499 end
|
flickerstreak@122
|
500 end
|
flickerstreak@122
|
501
|
flickerstreak@161
|
502 function Action:GetUsable()
|
flickerstreak@161
|
503 return IsUsableAction(self.actionID)
|
flickerstreak@161
|
504 end
|
flickerstreak@161
|
505
|
flickerstreak@161
|
506 function Action:GetInRange()
|
flickerstreak@161
|
507 return IsActionInRange(self.actionID) == 0
|
flickerstreak@161
|
508 end
|
flickerstreak@161
|
509
|
flickerstreak@122
|
510 function Action:UpdateCooldown()
|
flickerstreak@161
|
511 CooldownFrame_SetTimer(self.frames.cooldown, self:GetCooldown())
|
flickerstreak@161
|
512 end
|
flickerstreak@161
|
513
|
flickerstreak@161
|
514 function Action:GetCooldown()
|
flickerstreak@161
|
515 return GetActionCooldown(self.actionID)
|
flickerstreak@122
|
516 end
|
flickerstreak@122
|
517
|
flickerstreak@122
|
518 function Action:UpdateFlash()
|
flickerstreak@122
|
519 local action = self.actionID
|
flickerstreak@122
|
520 self:SetFlash( (IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action) )
|
flickerstreak@122
|
521 end
|
flickerstreak@122
|
522
|
flickerstreak@122
|
523 function Action:SetFlash(flash)
|
flickerstreak@122
|
524 if self.flashing ~= flash then
|
flickerstreak@122
|
525 self.flashing = flash
|
flickerstreak@122
|
526 self.flashtime = 0
|
flickerstreak@122
|
527 if not flash then
|
flickerstreak@122
|
528 self.frames.flash:Hide()
|
flickerstreak@122
|
529 end
|
flickerstreak@122
|
530 self:UpdateCheckedState()
|
flickerstreak@122
|
531 end
|
flickerstreak@122
|
532 end
|
flickerstreak@122
|
533
|
flickerstreak@122
|
534 function Action:RunFlash(elapsed)
|
flickerstreak@122
|
535 if self.flashing then
|
flickerstreak@122
|
536 local flashtime = self.flashtime - elapsed
|
flickerstreak@122
|
537 self.flashtime = flashtime
|
flickerstreak@122
|
538 if flashtime <= 0 then
|
flickerstreak@122
|
539 local overtime = -flashtime
|
flickerstreak@122
|
540 if overtime >= ATTACK_BUTTON_FLASH_TIME then
|
flickerstreak@122
|
541 overtime = 0
|
flickerstreak@122
|
542 end
|
flickerstreak@122
|
543 flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
|
flickerstreak@122
|
544 local flash = self.frames.flash
|
flickerstreak@122
|
545 if flash:IsShown() then
|
flickerstreak@122
|
546 flash:Hide()
|
flickerstreak@122
|
547 else
|
flickerstreak@122
|
548 flash:Show()
|
flickerstreak@122
|
549 end
|
flickerstreak@122
|
550 end
|
flickerstreak@122
|
551 end
|
flickerstreak@122
|
552 end
|
flickerstreak@122
|
553
|
flickerstreak@122
|
554 function Action:RunRangeFinder(elapsed)
|
flickerstreak@122
|
555 local rangeTimer = self.rangeTimer
|
flickerstreak@122
|
556 if rangeTimer then
|
flickerstreak@122
|
557 rangeTimer = rangeTimer - elapsed
|
flickerstreak@122
|
558 self.rangeTimer = rangeTimer
|
flickerstreak@122
|
559 if rangeTimer <= 0 then
|
flickerstreak@159
|
560 self:UpdateUsable()
|
flickerstreak@123
|
561 self.rangeTimer = TOOLTIP_UPDATE_TIME
|
flickerstreak@122
|
562 end
|
flickerstreak@122
|
563 end
|
flickerstreak@122
|
564 end
|
flickerstreak@122
|
565
|
flickerstreak@122
|
566 function Action:GetActionID(page)
|
flickerstreak@122
|
567 if page == nil then
|
flickerstreak@122
|
568 -- get the effective ID
|
flickerstreak@122
|
569 return self:GetFrame():GetAttribute("action")
|
flickerstreak@122
|
570 else
|
flickerstreak@122
|
571 if page == 1 then
|
flickerstreak@122
|
572 return self.config.actionID
|
flickerstreak@122
|
573 else
|
flickerstreak@122
|
574 return self.config.pageactions and self.config.pageactions[page] or self.config.actionID
|
flickerstreak@122
|
575 end
|
flickerstreak@122
|
576 end
|
flickerstreak@122
|
577 end
|
flickerstreak@122
|
578
|
flickerstreak@122
|
579 function Action:SetActionID( id, page )
|
flickerstreak@122
|
580 id = tonumber(id)
|
flickerstreak@122
|
581 page = tonumber(page)
|
flickerstreak@122
|
582 if id == nil or id < 1 or id > 120 then
|
flickerstreak@129
|
583 ReAction:UserError(L["Action ID range is 1-120"])
|
flickerstreak@129
|
584 return
|
flickerstreak@122
|
585 end
|
flickerstreak@122
|
586 if page and page ~= 1 then
|
flickerstreak@122
|
587 if not self.config.pageactions then
|
flickerstreak@122
|
588 self.config.pageactions = { }
|
flickerstreak@122
|
589 end
|
flickerstreak@122
|
590 self:ReleaseActionID(self.config.pageactions[page])
|
flickerstreak@122
|
591 self.config.pageactions[page] = id
|
flickerstreak@122
|
592 self:AcquireActionID(self.config.pageactions[page])
|
flickerstreak@122
|
593 self.frame:SetAttribute("action-page"..page,id)
|
flickerstreak@122
|
594 else
|
flickerstreak@122
|
595 self:ReleaseActionID(self.config.actionID)
|
flickerstreak@122
|
596 self.config.actionID = id
|
flickerstreak@122
|
597 self:AcquireActionID(self.config.actionID)
|
flickerstreak@122
|
598 self.frame:SetAttribute("action",id)
|
flickerstreak@122
|
599 self.frame:SetAttribute("default-action",id)
|
flickerstreak@122
|
600 if self.config.pageactions then
|
flickerstreak@122
|
601 self.config.pageactions[1] = id
|
flickerstreak@122
|
602 self.frame:SetAttribute("action-page1",id)
|
flickerstreak@122
|
603 end
|
flickerstreak@122
|
604 end
|
flickerstreak@122
|
605 end
|
flickerstreak@122
|
606
|
flickerstreak@122
|
607 function Action:RefreshPages( force )
|
flickerstreak@128
|
608 local nPages = self:GetBarConfig().nPages
|
flickerstreak@122
|
609 if nPages and (nPages ~= self.nPages or force) then
|
flickerstreak@122
|
610 local f = self:GetFrame()
|
flickerstreak@122
|
611 local c = self.config.pageactions
|
flickerstreak@122
|
612 if nPages > 1 and not c then
|
flickerstreak@122
|
613 c = { }
|
flickerstreak@122
|
614 self.config.pageactions = c
|
flickerstreak@122
|
615 end
|
flickerstreak@122
|
616 for i = 1, nPages do
|
flickerstreak@122
|
617 if i > 1 then
|
flickerstreak@122
|
618 c[i] = self:AcquireActionID(c[i], self.config.actionID + (i-1)*self.bar:GetNumButtons())
|
flickerstreak@122
|
619 else
|
flickerstreak@122
|
620 c[i] = self.config.actionID -- page 1 is the same as the base actionID
|
flickerstreak@122
|
621 end
|
flickerstreak@129
|
622 f:SetAttribute("action-page"..i,c[i])
|
flickerstreak@122
|
623 end
|
flickerstreak@122
|
624 for i = nPages+1, #c do
|
flickerstreak@122
|
625 self:ReleaseActionID(c[i])
|
flickerstreak@122
|
626 c[i] = nil
|
flickerstreak@129
|
627 f:SetAttribute("action-page"..i,nil)
|
flickerstreak@122
|
628 end
|
flickerstreak@122
|
629 self.nPages = nPages
|
flickerstreak@122
|
630 end
|
flickerstreak@122
|
631 end
|
flickerstreak@122
|
632
|
Flick@234
|
633 function Action:SetupBar( bar )
|
Flick@234
|
634 Super.SetupBar(self,bar)
|
Flick@234
|
635
|
flickerstreak@122
|
636 local f = bar:GetFrame()
|
Flick@234
|
637 local config = bar:GetConfig()
|
flickerstreak@128
|
638 f:SetAttribute("mindcontrol",config.mindcontrol)
|
flickerstreak@128
|
639 f:SetAttribute("vehicle",config.vehicle)
|
flickerstreak@122
|
640 f:Execute(
|
flickerstreak@122
|
641 [[
|
flickerstreak@122
|
642 doMindControl = self:GetAttribute("mindcontrol")
|
flickerstreak@122
|
643 doVehicle = self:GetAttribute("vehicle")
|
flickerstreak@122
|
644 control:ChildUpdate()
|
flickerstreak@122
|
645 ]])
|
flickerstreak@122
|
646
|
flickerstreak@122
|
647 f:SetAttribute("_onstate-mc", _onstate_mc)
|
flickerstreak@165
|
648 RegisterStateDriver(f, "mc", "[vehicleui] vehicle; [bonusbar:5] mc; none")
|
flickerstreak@122
|
649
|
flickerstreak@128
|
650 f:SetAttribute("lockbuttons",config.lockButtons)
|
flickerstreak@128
|
651 f:SetAttribute("lockbuttonscombat",config.lockButtonsCombat)
|
flickerstreak@122
|
652 f:Execute(
|
flickerstreak@122
|
653 [[
|
flickerstreak@122
|
654 lockButtons = self:GetAttribute("lockbuttons")
|
flickerstreak@122
|
655 lockButtonsCombat = self:GetAttribute("lockbuttonscombat")
|
flickerstreak@122
|
656 ]])
|
flickerstreak@122
|
657 end
|
flickerstreak@122
|
658
|
flickerstreak@122
|
659
|
Flick@237
|
660 function Action:SetButtonLock( bar, lock, lockCombat )
|
flickerstreak@123
|
661 local f = bar:GetFrame()
|
flickerstreak@123
|
662 f:SetAttribute("lockbuttons",lock)
|
flickerstreak@123
|
663 f:SetAttribute("lockbuttonscombat",lockCombat)
|
flickerstreak@123
|
664 f:Execute(
|
flickerstreak@123
|
665 [[
|
flickerstreak@123
|
666 lockButtons = self:GetAttribute("lockbuttons")
|
flickerstreak@123
|
667 lockButtonsCombat = self:GetAttribute("lockbuttonscombat")
|
flickerstreak@123
|
668 ]])
|
flickerstreak@123
|
669 end
|
flickerstreak@123
|
670
|
flickerstreak@123
|
671
|
flickerstreak@122
|
672 function Action:ShowVehicleExit(show)
|
flickerstreak@145
|
673 self.vehicleExitMode = show and self:GetBarConfig().vehicle
|
flickerstreak@145
|
674 self:UpdateIcon()
|
flickerstreak@122
|
675 end
|
flickerstreak@122
|
676
|
flickerstreak@122
|
677 function Action:OnEnter( )
|
flickerstreak@122
|
678 self:SetTooltip()
|
flickerstreak@122
|
679 end
|
flickerstreak@122
|
680
|
flickerstreak@122
|
681 function Action:OnLeave( )
|
flickerstreak@122
|
682 GameTooltip:Hide()
|
flickerstreak@122
|
683 end
|
flickerstreak@122
|
684
|
flickerstreak@122
|
685 function Action:OnAttributeChanged( attr, value )
|
flickerstreak@161
|
686 if attr ~= "statehidden" then
|
flickerstreak@161
|
687 self:UpdateAction()
|
flickerstreak@161
|
688 end
|
Flick@238
|
689 local f = self:GetFrame()
|
Flick@238
|
690 f.action = f:GetAttribute("action") -- support ActionButton_UpdateFlyout
|
flickerstreak@122
|
691 end
|
flickerstreak@122
|
692
|
flickerstreak@122
|
693 function Action:PostClick( )
|
flickerstreak@122
|
694 self:UpdateCheckedState()
|
flickerstreak@122
|
695 end
|
flickerstreak@122
|
696
|
flickerstreak@122
|
697 function Action:OnUpdate( elapsed )
|
flickerstreak@122
|
698 self:RunFlash(elapsed)
|
flickerstreak@122
|
699 self:RunRangeFinder(elapsed)
|
flickerstreak@122
|
700 end
|
flickerstreak@122
|
701
|
flickerstreak@122
|
702 function Action:OnDragStart()
|
flickerstreak@122
|
703 self:UpdateCheckedState()
|
flickerstreak@122
|
704 self:UpdateFlash()
|
flickerstreak@122
|
705 end
|
flickerstreak@122
|
706
|
flickerstreak@122
|
707 function Action:OnReceiveDrag()
|
flickerstreak@122
|
708 self:UpdateCheckedState()
|
flickerstreak@122
|
709 self:UpdateFlash()
|
flickerstreak@122
|
710 end
|
flickerstreak@122
|
711
|
flickerstreak@122
|
712 function Action:OnEvent(event, ...)
|
flickerstreak@122
|
713 if self[event] then
|
flickerstreak@122
|
714 self[event](self, event, ...)
|
flickerstreak@122
|
715 end
|
flickerstreak@122
|
716 end
|
flickerstreak@122
|
717
|
flickerstreak@122
|
718 function Action:ACTIONBAR_SLOT_CHANGED(event, action)
|
flickerstreak@122
|
719 if action == 0 or action == self.actionID then
|
flickerstreak@128
|
720 self:UpdateAll()
|
flickerstreak@122
|
721 end
|
flickerstreak@122
|
722 end
|
flickerstreak@122
|
723
|
flickerstreak@122
|
724 function Action:PLAYER_ENTERING_WORLD()
|
flickerstreak@122
|
725 self:UpdateAction()
|
flickerstreak@122
|
726 end
|
flickerstreak@122
|
727
|
flickerstreak@122
|
728 function Action:ACTIONBAR_PAGE_CHANGED()
|
flickerstreak@122
|
729 self:UpdateAction()
|
flickerstreak@122
|
730 end
|
flickerstreak@122
|
731
|
flickerstreak@122
|
732 function Action:UPDATE_BONUS_ACTIONBAR()
|
flickerstreak@122
|
733 self:UpdateAction()
|
flickerstreak@122
|
734 end
|
flickerstreak@122
|
735
|
flickerstreak@122
|
736 function Action:UPDATE_BINDINGS()
|
flickerstreak@122
|
737 self:UpdateHotkey()
|
flickerstreak@122
|
738 end
|
flickerstreak@122
|
739
|
flickerstreak@122
|
740 function Action:PLAYER_TARGET_CHANGED()
|
flickerstreak@122
|
741 self.rangeTimer = -1
|
flickerstreak@122
|
742 end
|
flickerstreak@122
|
743
|
flickerstreak@122
|
744 function Action:ACTIONBAR_UPDATE_STATE()
|
flickerstreak@122
|
745 self:UpdateCheckedState()
|
flickerstreak@122
|
746 end
|
flickerstreak@124
|
747
|
flickerstreak@124
|
748 function Action:TRADE_SKILL_SHOW()
|
flickerstreak@124
|
749 self:UpdateCheckedState()
|
flickerstreak@124
|
750 end
|
flickerstreak@124
|
751 Action.TRADE_SKILL_CLOSE = Action.TRADE_SKILL_CLOSE
|
flickerstreak@122
|
752
|
flickerstreak@122
|
753 function Action:UNIT_ENTERED_VEHICLE(event,unit)
|
flickerstreak@122
|
754 if unit == "player" then
|
flickerstreak@122
|
755 self:UpdateCheckedState()
|
flickerstreak@122
|
756 end
|
flickerstreak@122
|
757 end
|
flickerstreak@122
|
758 Action.UNIT_EXITED_VEHICLE = Action.UNIT_ENTERED_VEHICLE
|
flickerstreak@122
|
759
|
flickerstreak@122
|
760 function Action:COMPANION_UPDATE(event,unit)
|
flickerstreak@122
|
761 if unit == "mount" then
|
flickerstreak@122
|
762 self:UpdateCheckedState()
|
flickerstreak@122
|
763 end
|
flickerstreak@122
|
764 end
|
flickerstreak@122
|
765
|
flickerstreak@122
|
766 function Action:ACTIONBAR_UPDATE_USABLE()
|
flickerstreak@122
|
767 self:UpdateUsable()
|
flickerstreak@122
|
768 end
|
flickerstreak@122
|
769
|
flickerstreak@122
|
770 function Action:ACTIONBAR_UPDATE_COOLDOWN()
|
flickerstreak@122
|
771 self:UpdateCooldown()
|
flickerstreak@122
|
772 end
|
flickerstreak@122
|
773
|
flickerstreak@122
|
774 function Action:PLAYER_ENTER_COMBAT()
|
flickerstreak@122
|
775 if IsAttackAction(self.actionID) then
|
flickerstreak@122
|
776 self:SetFlash(true)
|
flickerstreak@122
|
777 end
|
flickerstreak@122
|
778 end
|
flickerstreak@122
|
779
|
flickerstreak@122
|
780 function Action:PLAYER_LEAVE_COMBAT()
|
flickerstreak@122
|
781 if IsAttackAction(self.actionID) then
|
flickerstreak@122
|
782 self:SetFlash(false)
|
flickerstreak@122
|
783 end
|
flickerstreak@122
|
784 end
|
flickerstreak@122
|
785
|
flickerstreak@122
|
786 function Action:START_AUTOREPEAT_SPELL()
|
flickerstreak@122
|
787 if IsAutoRepeatAction(self.actionID) then
|
flickerstreak@122
|
788 self:SetFlash(true)
|
flickerstreak@122
|
789 end
|
flickerstreak@122
|
790 end
|
flickerstreak@122
|
791
|
flickerstreak@122
|
792 function Action:STOP_AUTOREPEAT_SPELL()
|
flickerstreak@122
|
793 if not IsAttackAction(self.actionID) then
|
flickerstreak@122
|
794 self:SetFlash(false)
|
flickerstreak@122
|
795 end
|
flickerstreak@122
|
796 end
|
flickerstreak@122
|
797
|
flickerstreak@165
|
798 function Action:UNIT_INVENTORY_CHANGED(unit)
|
flickerstreak@165
|
799 if unit == "player" then
|
flickerstreak@165
|
800 self:UpdateTooltip()
|
flickerstreak@165
|
801 end
|
flickerstreak@165
|
802 end
|
flickerstreak@165
|
803
|
flickerstreak@165
|
804 function Action:LEARNED_SPELL_IN_TAB()
|
flickerstreak@165
|
805 self:UpdateTooltip()
|
flickerstreak@165
|
806 end
|