Re-implemented Right-Click self-casting
This commit is contained in:
+2
-4
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
+2
-2
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user