Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-22-23, 07:08 PM   #1
r00tdownx
A Kobold Labourer
Join Date: Feb 2023
Posts: 1
Gello's Cycle Arena Modification

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.

Thanks!

-- binding definitions
BINDING_HEADER_CYCLEARENA = "Cycle Arena"
_G["BINDING_NAME_CLICK CycleArenaTarget:LeftButton"] = "Cycle Arena Target Forward"
_G["BINDING_NAME_CLICK CycleArenaTarget:RightButton"] = "Cycle Arena Target Backward"
_G["BINDING_NAME_CLICK CycleArenaFocus:LeftButton"] = "Cycle Arena Focus Forward"
_G["BINDING_NAME_CLICK CycleArenaFocus:RightButton"] = "Cycle Arena Focus Backward"
_G["BINDING_NAME_CLICK CyclePartyTarget:LeftButton"] = "Cycle Party Target Forward"
_G["BINDING_NAME_CLICK CyclePartyTarget:RightButton"] = "Cycle Party Target Backward"
_G["BINDING_NAME_CLICK CyclePartyFocus:LeftButton"] = "Cycle Party Focus Forward"
_G["BINDING_NAME_CLICK CyclePartyFocus:RightButton"] = "Cycle Party Focus Backward"
_G["BINDING_NAME_CLICK CycleRaidTarget:LeftButton"] = "Cycle Raid Target Forward"
_G["BINDING_NAME_CLICK CycleRaidTarget:RightButton"] = "Cycle Raid Target Backward"
_G["BINDING_NAME_CLICK CycleRaidFocus:LeftButton"] = "Cycle Raid Focus Forward"
_G["BINDING_NAME_CLICK CycleRaidFocus:RightButton"] = "Cycle Raid Focus Backward"

-- 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
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Gello's Cycle Arena Modification


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off