Skip to content

Commit

Permalink
Re-implemented Right-Click self-casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Sep 28, 2008
1 parent 8a78292 commit 93ad63a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
6 changes: 2 additions & 4 deletions ActionBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 0 additions & 16 deletions ActionBarStates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions ActionButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Options/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down

0 comments on commit 93ad63a

Please sign in to comment.