Hi guys I would like to mod gello's arena cycles. Could someone help me out?
1. I would like the functionality so the leftbutton will not cycle past party1 and the rightbutton will not cycle past party5. Right now it loops from party1 to party5.
2. If no party member is selected I would like leftbutton to select party1 and rightbutton to select the bottom party member either 2/3/5 or 40 depending on party size.
-- create a secure button for each binding
for k,name in pairs({"CycleArenaTarget","CycleArenaFocus","CyclePartyTarget","CyclePartyFocus","CycleRaidTarget","CycleRaidFocus"}) do
local button = CreateFrame("Button",name,nil,"SecureActionButtonTemplate")
-- set up persistent attributes to describe the button's behavior
button:SetAttribute("maxUnits",k<=4 and 5 or 40)
button:SetAttribute("unitType",k<=2 and "arena" or k<=4 and "party" or "raid")
button:SetAttribute("unitIndex",0)
local targetType = k%2==0 and "focus" or "target"
button:SetAttribute("type1",targetType)
button:SetAttribute("type2",targetType)
button:RegisterForClicks(GetCVarBool("ActionButtonUseKeyDown") and "AnyDown" or "AnyUp")
-- create a pre-click snippet to increment/decrement unit
SecureHandlerWrapScript(button,"OnClick",button,[[
local maxUnits = self:GetAttribute("maxUnits") -- 5 for arena, 5 for party, 40 for raid
local unitType = self:GetAttribute("unitType")
local index = self:GetAttribute("unitIndex") -- number 0-X of last seen unit
local direction = button=="RightButton" and -1 or 1
for i=1,maxUnits do
index = (index+direction)%5
local unit = unitType..index+1
if unit=="party5" then
unit = "player" -- for party targeting, 5th unit is player
end
if UnitExists(unit) then
self:SetAttribute("unitIndex",index)
self:SetAttribute("unit",unit)
return
end
end
self:SetAttribute("unit",nil) -- if no unit, don't target
]])
end