diff --git a/Objects/ACTIONBUTTON.lua b/Objects/ACTIONBUTTON.lua index 9c4aedc9..b306629f 100644 --- a/Objects/ACTIONBUTTON.lua +++ b/Objects/ACTIONBUTTON.lua @@ -399,6 +399,8 @@ function ACTIONBUTTON:UpdateData() end end + + self.unit = target or "target" if abilityOrItem and #abilityOrItem > 0 and command:find("/castsequence") then --this always will set the button info the next ability or item in the sequence @@ -505,7 +507,7 @@ ACTIONBUTTON.PLAYER_STOPPED_MOVING = ACTIONBUTTON.PLAYER_STARTED_MOVING function ACTIONBUTTON:BAG_UPDATE_COOLDOWN() if self.item then - self:UpdateState() + self:UpdateStatus() end end ACTIONBUTTON.BAG_UPDATE = ACTIONBUTTON.BAG_UPDATE_COOLDOWN @@ -721,25 +723,20 @@ end function ACTIONBUTTON:SetSpellIcon(spell) local texture - if not self.data.macro_BlizzMacro and not self.data.macro_EquipmentSet then - spell = spell:lower() + spell = spell:lower() - if NeuronSpellCache[spell] then - texture = GetSpellTexture(spell) --try getting a new texture first (this is important for things like Wild Charge that has different icons per spec - if not texture then --if you don't find a new icon (meaning the spell isn't currently learned) default to icon in the database - texture = NeuronSpellCache[spell].icon - end - elseif NeuronCollectionCache[spell] then - texture = NeuronCollectionCache[spell].icon - elseif spell then - texture = GetSpellTexture(spell) - end - else - if self.data.macro_BlizzMacro then - _, texture = GetMacroInfo(self.data.macro_BlizzMacro) + if NeuronSpellCache[spell] then + texture = GetSpellTexture(spell) --try getting a new texture first (this is important for things like Wild Charge that has different icons per spec + if not texture then --if you don't find a new icon (meaning the spell isn't currently learned) default to icon in the database + texture = NeuronSpellCache[spell].icon end + elseif NeuronCollectionCache[spell] then + texture = NeuronCollectionCache[spell].icon + elseif spell then + texture = GetSpellTexture(spell) end + if texture then self.elements.IconFrameIcon:SetTexture(texture) else @@ -777,7 +774,7 @@ function ACTIONBUTTON:SetActionIcon(action) local texture local actionID = tonumber(action) - if actionID and HasAction(actionID)then + if actionID and HasAction(actionID) then texture = GetActionTexture(actionID) end @@ -792,16 +789,20 @@ function ACTIONBUTTON:SetActionIcon(action) end ----------------------------------------------------------------------------------------- --------------------------------------- Set State ---------------------------------------- +-------------------------------------- Set Status --------------------------------------- ----------------------------------------------------------------------------------------- -function ACTIONBUTTON:UpdateState() +function ACTIONBUTTON:UpdateStatus() if self.actionID then - self:SetActionState(self.actionID) + self:SetActionStatus(self.actionID) + elseif self.data.macro_BlizzMacro then + self.elements.Name:SetText(self.data.macro_Name) + elseif self.data.macro_EquipmentSet then + self.elements.Name:SetText(self.data.macro_Name) elseif self.spell then - self:SetSpellState(self.spell) + self:SetSpellStatus(self.spell) elseif self.item then - self:SetItemState(self.item) + self:SetItemStatus(self.item) else self:SetChecked(nil) self.elements.Name:SetText("") @@ -809,7 +810,7 @@ function ACTIONBUTTON:UpdateState() end end -function ACTIONBUTTON:SetSpellState(spell) +function ACTIONBUTTON:SetSpellStatus(spell) if IsCurrentSpell(spell) or IsAutoRepeatSpell(spell) then self:SetChecked(1) else @@ -819,10 +820,9 @@ function ACTIONBUTTON:SetSpellState(spell) self.elements.Name:SetText(self.data.macro_Name) self:UpdateSpellCount(spell) self:UpdateUsable() - end -function ACTIONBUTTON:SetItemState(item) +function ACTIONBUTTON:SetItemStatus(item) if IsCurrentItem(item) then self:SetChecked(1) else @@ -834,8 +834,9 @@ function ACTIONBUTTON:SetItemState(item) self:UpdateUsable() end -function ACTIONBUTTON:SetActionState(action) +function ACTIONBUTTON:SetActionStatus(action) local actionID = tonumber(action) + local name if actionID then if IsCurrentAction(actionID) or IsAutoRepeatAction(actionID) then @@ -843,11 +844,24 @@ function ACTIONBUTTON:SetActionState(action) else self:SetChecked(nil) end + + --find out the action name + local type, id, _ = GetActionInfo(self.actionID) + if type == "spell" then + name = GetSpellInfo(id) + elseif type == "item" then + name = GetItemInfo(id) + end + else self:SetChecked(nil) end - self.elements.Name:SetText("") + if name then + self.elements.Name:SetText(name) + else + self.elements.Name:SetText("") + end self.elements.Count:SetText("") self:UpdateUsable() end diff --git a/Objects/ACTIONBUTTON_DragAndDrop.lua b/Objects/ACTIONBUTTON_DragAndDrop.lua index 2076dde0..86ede25b 100644 --- a/Objects/ACTIONBUTTON_DragAndDrop.lua +++ b/Objects/ACTIONBUTTON_DragAndDrop.lua @@ -348,6 +348,7 @@ function ACTIONBUTTON:PlaceBlizzEquipSet(equipmentSetName) end local name, texture = C_EquipmentSet.GetEquipmentSetInfo(equipsetNameIndex) + if texture then self.data.macro_Text = "/equipset "..equipmentSetName self.data.macro_Name = name @@ -360,7 +361,6 @@ function ACTIONBUTTON:PlaceBlizzEquipSet(equipmentSetName) self.data.macro_EquipmentSet = false end - self.data.macro_Name = "" self.data.macro_Note = "" self.data.macro_UseNote = false self.data.macro_BlizzMacro = false diff --git a/Objects/ACTIONBUTTON_Flyout.lua b/Objects/ACTIONBUTTON_Flyout.lua index 2be58eb1..d8e63ffe 100644 --- a/Objects/ACTIONBUTTON_Flyout.lua +++ b/Objects/ACTIONBUTTON_Flyout.lua @@ -835,7 +835,7 @@ function ACTIONBUTTON:Flyout_PostClick() button:MACRO_Reset() button:UpdateAll() - self:UpdateState() + self:UpdateStatus() end function ACTIONBUTTON:Flyout_GetButton() @@ -893,8 +893,8 @@ function ACTIONBUTTON:Flyout_GetButton() newButton:SetScript("OnEnter", function(self, ...) self:OnEnter(...) end) newButton:SetScript("OnLeave", function(self, ...) self:OnLeave(...) end) - newButton:SetScript("OnShow", function(self) self:UpdateUsable(); self:UpdateIcon(); self:UpdateState() end) - newButton:SetScript("OnHide", function(self) self:UpdateUsable(); self:UpdateIcon(); self:UpdateState() end) + newButton:SetScript("OnShow", function(self) self:UpdateUsable(); self:UpdateIcon(); self:UpdateStatus() end) + newButton:SetScript("OnHide", function(self) self:UpdateUsable(); self:UpdateIcon(); self:UpdateStatus() end) newButton:WrapScript(newButton, "OnClick", [[ local button = self:GetParent():GetParent() diff --git a/Objects/BAR.lua b/Objects/BAR.lua index 0c96575a..97d4862a 100644 --- a/Objects/BAR.lua +++ b/Objects/BAR.lua @@ -684,7 +684,7 @@ function BAR:ClearStates(handler, state) end -function BAR:UpdateStates(handler) +function BAR:UpdateStatuss(handler) for state, values in pairs(MAS) do if self.data[state] then @@ -1064,7 +1064,7 @@ function BAR:Update(show, hide) if self.stateschanged then - self:UpdateStates(handler) + self:UpdateStatuss(handler) self.stateschanged = nil end diff --git a/Objects/BUTTON.lua b/Objects/BUTTON.lua index 867e02a9..7ae6398b 100644 --- a/Objects/BUTTON.lua +++ b/Objects/BUTTON.lua @@ -838,7 +838,7 @@ function BUTTON:UpdateAll() self:UpdateData() self:UpdateUsable() self:UpdateIcon() - self:UpdateState() + self:UpdateStatus() self:UpdateTimers() self:UpdateNormalTexture() end @@ -856,7 +856,7 @@ function BUTTON:UpdateIcon() -- empty -- end -function BUTTON:UpdateState() +function BUTTON:UpdateStatus() -- empty -- end diff --git a/Objects/PETBTN.lua b/Objects/PETBTN.lua index b1b59710..42818f18 100644 --- a/Objects/PETBTN.lua +++ b/Objects/PETBTN.lua @@ -120,7 +120,7 @@ function PETBTN:PET_UpdateIcon(spell, texture, isToken) end end -function PETBTN:PET_UpdateState(isActive, allowed, enabled) +function PETBTN:PET_UpdateStatus(isActive, allowed, enabled) if isActive then @@ -221,7 +221,7 @@ function PETBTN:PET_UpdateOnEvent(state) end end - self:PET_UpdateState(isActive, allowed, enabled) + self:PET_UpdateStatus(isActive, allowed, enabled) end