diff --git a/ActionBar.lua b/ActionBar.lua index 19c4bfe..38281f7 100644 --- a/ActionBar.lua +++ b/ActionBar.lua @@ -133,9 +133,7 @@ function ActionBar:GetHideHotkey() return self.config.hidehotkey end -function ActionBar:UpdateSelfCast(nostates) +function ActionBar:UpdateSelfCast() self:ForAll("SetAttribute", "checkselfcast", Bartender4.db.profile.selfcastmodifier and true or nil) - if not nostates then - self:UpdateStates() - end + self:UpdateStates() end diff --git a/ActionBarStates.lua b/ActionBarStates.lua index 3248cf0..d1286e8 100644 --- a/ActionBarStates.lua +++ b/ActionBarStates.lua @@ -175,22 +175,6 @@ function ActionBar:AddButtonStates(state, page) local action = (page == 0) and button.id or (button.rid + (page - 1) * 12) button:SetStateAction(state, action) end - self:AddRightClickState(state) - self:AddToStateButton(state) -end - -function ActionBar:AddToStateButton(state) - if not self.statebutton then self.statebutton = {} end - if not tfind(self.statebutton, state) then - table_insert(self.statebutton, state) - end -end - -function ActionBar:AddRightClickState(state) - local scrc = Bartender4.db.profile.selfcastrightclick - local target = scrc and "player" or nil - - self:SetAttribute("unit-S" .. state .. "Right", target) end function ActionBar:GetStateOption(key) diff --git a/ActionButton.lua b/ActionButton.lua index 3098528..4b536cf 100644 --- a/ActionButton.lua +++ b/ActionButton.lua @@ -262,6 +262,15 @@ function Button:RefreshStateAction(state) end end end + self:UpdateRightClickSelfCast() +end + +function Button:UpdateRightClickSelfCast() + if Bartender4.db.profile.selfcastrightclick then + self:SetAttribute("unit2", "player") + else + self:SetAttribute("unit2", nil) + end end function Button:CalculateAction() diff --git a/Options/Options.lua b/Options/Options.lua index 65edb31..f901327 100644 --- a/Options/Options.lua +++ b/Options/Options.lua @@ -53,7 +53,7 @@ local function getOptions() get = getFunc, set = function(info, value) Bartender4.db.profile.selfcastmodifier = value - Bartender4.Bar:ForAll("UpdateSelfCast", true) + Bartender4.Bar:ForAll("UpdateSelfCast") end, }, selfcastrightclick = { @@ -64,7 +64,7 @@ local function getOptions() get = getFunc, set = function(info, value) Bartender4.db.profile.selfcastrightclick = value - Bartender4.Bar:ForAll("UpdateSelfCast") + Bartender4:GetModule("ActionBars"):ForAll("ForAll", "UpdateRightClickSelfCast") end, }, range = {