Mercurial > wow > reaction
changeset 297:f7a5676c9517
5.04 updates:
- refresh button checked state and cooldown in C-code
- display count for actions with charges
- update action button events
- pet action buttons - filter UNIT_AURA events by 'pet' type
author | Flick |
---|---|
date | Wed, 14 Nov 2012 16:34:14 -0800 |
parents | 08a1fbc9ee9b |
children | d1a56601267b |
files | ActionButton.lua PetActionButton.lua |
diffstat | 2 files changed, 37 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/ActionButton.lua Tue Sep 11 16:51:29 2012 -0700 +++ b/ActionButton.lua Wed Nov 14 16:34:14 2012 -0800 @@ -147,12 +147,9 @@ -- local eventList = { "PLAYER_ENTERING_WORLD", - "ACTIONBAR_PAGE_CHANGED", "ACTIONBAR_SLOT_CHANGED", "UPDATE_BINDINGS", - "ACTIONBAR_UPDATE_STATE", "ACTIONBAR_UPDATE_USABLE", - "ACTIONBAR_UPDATE_COOLDOWN", "UNIT_INVENTORY_CHANGED", "LEARNED_SPELL_IN_TAB", "UPDATE_INVENTORY_ALERTS", @@ -167,6 +164,9 @@ "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "COMPANION_UPDATE", + "UPDATE_SHAPESHIFT_FORM", + "SPELL_UPDATE_CHARGES", + "UPDATE_SUMMONPETS_ACTION", } -- @@ -345,7 +345,6 @@ self:UpdateTooltip() self:UpdateCheckedState() self:UpdateUsable() - self:UpdateCooldown() self:UpdateFlash() end @@ -353,6 +352,11 @@ local action = self:GetActionID() if action ~= self.actionID then self.actionID = action + + -- update checked state and cooldown in C-code + local f = self:GetFrame() + SetActionUIButton(f, action, f.cooldown) + self:UpdateAll() end end @@ -395,12 +399,10 @@ end icon:Show() self.rangeTimer = -1 - f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") else icon:Hide() self.frames.cooldown:Hide() self.rangeTimer = nil - f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") end end @@ -422,7 +424,9 @@ function Action:UpdateMacroText() local action = self.actionID - if not IsConsumableAction(action) and not IsStackableAction(action) then + if not IsConsumableAction(action) and + not IsStackableAction(action) and + (IsItemAction(action) or GetActionCount(action) == 0) then self.frames.name:SetText(GetActionText(action)) else self.frames.name:SetText("") @@ -431,10 +435,22 @@ function Action:UpdateCount() local action = self.actionID - if IsConsumableAction(action) or IsStackableAction(action) then - self.frames.count:SetText(GetActionCount(action)) + local count = GetActionCount(action) or 0 + if IsConsumableAction(action) or IsStackableAction(action) or (not IsItemAction(action) and count > 0) then + if count > 9999 then + self.frames.count:SetText("*") + else + self.frames.count:SetText(count) + end else - self.frames.count:SetText("") + local charges, maxCharges, chargeStart, chargeDuration = GetActionCharges(action) + charges = tonumber(charges) or 0 + maxCharges = tonumber(maxCharges) or 0 + if maxCharges > 1 then + self.frames.count:SetText(charges) + else + self.frames.count:SetText("") + end end end @@ -505,10 +521,6 @@ return IsActionInRange(self.actionID) == 0 end -function Action:UpdateCooldown() - CooldownFrame_SetTimer(self.frames.cooldown, self:GetCooldown()) -end - function Action:GetCooldown() return GetActionCooldown(self.actionID) end @@ -723,14 +735,6 @@ self:UpdateAction() end -function Action:ACTIONBAR_PAGE_CHANGED() - self:UpdateAction() -end - -function Action:UPDATE_BONUS_ACTIONBAR() - self:UpdateAction() -end - function Action:UPDATE_BINDINGS() self:UpdateHotkey() end @@ -739,10 +743,6 @@ self.rangeTimer = -1 end -function Action:ACTIONBAR_UPDATE_STATE() - self:UpdateCheckedState() -end - function Action:TRADE_SKILL_SHOW() self:UpdateCheckedState() end @@ -766,8 +766,8 @@ self:UpdateUsable() end -function Action:ACTIONBAR_UPDATE_COOLDOWN() - self:UpdateCooldown() +function Action:SPELL_UPDATE_CHARGES() + self:UpdateCount() end function Action:PLAYER_ENTER_COMBAT() @@ -794,6 +794,10 @@ end end +function Action:UPDATE_SHAPESHIFT_FORM() + self:UpdateIcon() +end + function Action:UNIT_INVENTORY_CHANGED(unit) if unit == "player" then self:UpdateTooltip() @@ -803,3 +807,7 @@ function Action:LEARNED_SPELL_IN_TAB() self:UpdateTooltip() end + +function Action:UPDATE_SUMMONPETS_ACTION() + self:UpdateIcon() +end
--- a/PetActionButton.lua Tue Sep 11 16:51:29 2012 -0700 +++ b/PetActionButton.lua Wed Nov 14 16:34:14 2012 -0800 @@ -47,7 +47,6 @@ "PLAYER_FARSIGHT_FOCUS_CHANGED", "UNIT_PET", "UNIT_FLAGS", -"UNIT_AURA", "PET_BAR_UPDATE", "PET_BAR_UPDATE_COOLDOWN", "PET_BAR_UPDATE_USABLE", @@ -145,6 +144,7 @@ for _, evt in pairs(eventList) do f:RegisterEvent(evt) end + f:RegisterUnitEvent("UNIT_AURA","pet") -- attach to skinner bar:SkinButton(self,