-
-
Save anonymous/733fc4a4d30d54ce6aec50d0c83ddffb to your computer and use it in GitHub Desktop.
Cycle Arena -> Party
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Bindings> | |
<Binding name="CLICK CyclePartyTarget:LeftButton" header="CYCLEPARTY" category="ADDONS"/> | |
<Binding name="CLICK CyclePartyTarget:RightButton" category="ADDONS"/> | |
<Binding name="CLICK CyclePartyFocus:LeftButton" category="ADDONS"/> | |
<Binding name="CLICK CyclePartyFocus:RightButton" category="ADDONS"/> | |
</Bindings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BINDING_HEADER_CYCLEARENA = "Cycle Party" | |
_G["BINDING_NAME_CLICK CyclePartyTarget:LeftButton"] = "Cycle Target Forward" | |
_G["BINDING_NAME_CLICK CyclePartyTarget:RightButton"] = "Cycle Target Backward" | |
_G["BINDING_NAME_CLICK CyclePartyFocus:LeftButton"] = "Cycle Focus Forward" | |
_G["BINDING_NAME_CLICK CyclePartyFocus:RightButton"] = "Cycle Focus Backward" | |
-- creating a parent frame so both target and focus can rotate from common unit | |
local parent = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate") | |
parent:SetAttribute("partyUnit",0) | |
-- setup target cycle | |
local target = CreateFrame("Button", "CyclePartyTarget", parent, "SecureActionButtonTemplate") | |
target:SetAttribute("type1","target") | |
target:SetAttribute("type2","target") | |
SecureHandlerWrapScript(target, "OnClick", target, [[ | |
local unit | |
local index = self:GetParent():GetAttribute("partyUnit") | |
local direction = button=="RightButton" and -1 or 1 | |
for i=1,5 do | |
index = (index+direction) | |
unit = "party"..index+1 | |
if UnitExists(unit) then | |
self:GetParent():SetAttribute("partyUnit",index) | |
self:SetAttribute("unit",unit) | |
return | |
end | |
end | |
self:SetAttribute("unit",nil) -- if no party enemy, don't target | |
]]) | |
-- setup focus cycle | |
local focus = CreateFrame("Button", "CyclePartyFocus", parent, "SecureActionButtonTemplate") | |
focus:SetAttribute("type1","focus") | |
focus:SetAttribute("type2","focus") | |
SecureHandlerWrapScript(focus, "OnClick", focus, [[ | |
local unit | |
local index = self:GetParent():GetAttribute("partyUnit") | |
local direction = button=="RightButton" and -1 or 1 | |
for i=1,5 do | |
index = (index+direction) | |
unit = "party"..index+1 | |
if UnitExists(unit) then | |
self:GetParent():SetAttribute("partyUnit",index) | |
self:SetAttribute("unit",unit) | |
return | |
end | |
end | |
self:SetAttribute("unit",nil) -- if no party enemy, don't focus | |
]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment