Mercurial > wow > reaction
diff ActionButton.lua @ 305:0211bcdfab70 stable
Merge 1.1 beta 12 to stable
author | Flick |
---|---|
date | Wed, 14 Nov 2012 16:47:27 -0800 |
parents | e337b39dc491 |
children |
line wrap: on
line diff
--- a/ActionButton.lua Fri Aug 05 16:28:13 2011 -0700 +++ b/ActionButton.lua Wed Nov 14 16:47:27 2012 -0800 @@ -46,8 +46,9 @@ (doMindControl and mcVehicleState == "mc") then local idx = self:GetAttribute("bar-idx") local maxN = (doVehicle and mcVehicleState == "vehicle") and 7 or 12 + local pageIndex = (doVehicle and mcVehicleState == "vehicle") and 12 or 14 if idx and idx <= maxN then - action = 120 + idx + action = 12*(pageIndex-1) + idx else action = 0 end @@ -146,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", @@ -166,6 +164,9 @@ "UNIT_ENTERED_VEHICLE", "UNIT_EXITED_VEHICLE", "COMPANION_UPDATE", + "UPDATE_SHAPESHIFT_FORM", + "SPELL_UPDATE_CHARGES", + "UPDATE_SUMMONPETS_ACTION", } -- @@ -186,7 +187,8 @@ }, barType = L["Action Bar"], - buttonTypeID = buttonTypeID + buttonTypeID = buttonTypeID, + eventList = eventList }, { __index = Super } ) @@ -344,7 +346,6 @@ self:UpdateTooltip() self:UpdateCheckedState() self:UpdateUsable() - self:UpdateCooldown() self:UpdateFlash() end @@ -352,6 +353,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 @@ -394,12 +400,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 @@ -421,7 +425,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("") @@ -430,10 +436,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 @@ -504,10 +522,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 @@ -642,7 +656,7 @@ ]]) f:SetAttribute("_onstate-mc", _onstate_mc) - RegisterStateDriver(f, "mc", "[vehicleui] vehicle; [bonusbar:5] mc; none") + RegisterStateDriver(f, "mc", "[vehicleui] vehicle; [overridebar] mc; none") f:SetAttribute("lockbuttons",config.lockButtons) f:SetAttribute("lockbuttonscombat",config.lockButtonsCombat) @@ -722,14 +736,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 @@ -738,10 +744,6 @@ self.rangeTimer = -1 end -function Action:ACTIONBAR_UPDATE_STATE() - self:UpdateCheckedState() -end - function Action:TRADE_SKILL_SHOW() self:UpdateCheckedState() end @@ -765,8 +767,8 @@ self:UpdateUsable() end -function Action:ACTIONBAR_UPDATE_COOLDOWN() - self:UpdateCooldown() +function Action:SPELL_UPDATE_CHARGES() + self:UpdateCount() end function Action:PLAYER_ENTER_COMBAT() @@ -793,6 +795,10 @@ end end +function Action:UPDATE_SHAPESHIFT_FORM() + self:UpdateIcon() +end + function Action:UNIT_INVENTORY_CHANGED(unit) if unit == "player" then self:UpdateTooltip() @@ -802,3 +808,7 @@ function Action:LEARNED_SPELL_IN_TAB() self:UpdateTooltip() end + +function Action:UPDATE_SUMMONPETS_ACTION() + self:UpdateIcon() +end