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