BINDING_HEADER_ZAPPOGRID = 'ZappOGrid Navigation' |
_G["BINDING_NAME_CLICK ZappOGridCursor:LeftButton"] = "Target unit under cursor" |
_G["BINDING_NAME_CLICK ZappOGridCursor:PrevUnit"] = "Target next unit in group" |
_G["BINDING_NAME_CLICK ZappOGridCursor:NextUnit"] = "Target last unit in group" |
_G["BINDING_NAME_CLICK ZappOGridCursor:PrevGroup"] = "Target unit in next group" |
_G["BINDING_NAME_CLICK ZappOGridCursor:NextGroup"] = "Target unit in last group" |
|
_G["BINDING_NAME_CLICK Demonomicon:RightButton"] = 'Open Demon Menu for Fast Summon' |
|
ZappOGrid = Grid:NewModule("ZappOGrid") |
ZappOGrid.container = GridLayout |
ZappOGrid.frame = CreateFrame("Button", "ZappOGridCursor", ZappOGrid.container.frame, "SecureActionButtonTemplate") |
|
local self = ZappOGridCursor |
self:SetBackdrop{ |
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], |
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], |
tile = "true", |
tileSize = 16, |
edgeSize = 16, |
insets = {left = 4, right = 4, top = 4, bottom = 4} |
} |
self:SetBackdropBorderColor(0.1, 0.6, 0.9) |
self:SetBackdropColor(0.1,0.6,0.9,1.0) |
self:EnableMouse(false) |
self:SetAttribute("useparent-unit", true) |
self:SetAttribute("type", "target") |
|
SecureHandler_OnLoad(self) |
|
local InitCode = [[ |
group = 1; member = 1; |
]] |
|
local Routines = {} |
Routines.PrevUnit = [[ |
member = member - 1 |
if member < 1 then |
member = select('#', groups[group]:GetChildren()) |
end |
]] |
Routines.NextUnit = [[ |
member = member + 1 |
if not groups[group]:GetFrameRef("child"..member) then |
member = 1 |
end |
]] |
Routines.PrevGroup = [[ |
group = group - 1 |
if group < 1 then |
group = #groups |
end |
]] |
Routines.NextGroup = [[ |
group = group + 1 |
if group > #groups then |
group = 1 |
end |
]] |
|
for func, body in pairs(Routines) do |
InitCode = ("%s\n%s = %q"):format(InitCode, func, body) |
end |
|
self:Execute(InitCode); |
|
self.PreClick = [[ -- (self, button, down) |
if _G[button] then |
local newUnit; |
|
local var = _G[button]:match("^%s*(%S+)") |
local start = _G[var] |
repeat |
control:Run(_G[button]) |
newUnit = groups[group]:GetFrameRef("child"..member) |
until newUnit and newUnit:GetAttribute("unit") or _G[var] == start; |
if newUnit then |
self:SetParent(newUnit) |
self:SetPoint("LEFT", newUnit, -3, 0) |
self:SetPoint("BOTTOM", newUnit, 0, -3) |
self:SetPoint("TOP", newUnit, 0, 3) |
self:SetPoint("RIGHT", newUnit, 3, 0) |
self:SetFrameLevel(newUnit:GetFrameLevel() + 1) |
end |
end |
]] |
self:WrapScript(self, 'OnClick', self.PreClick) |
|
local GridLayout_PlaceGroup = GridLayout.PlaceGroup |
function GridLayout:PlaceGroup(layoutGroup, groupNumber, ...) |
GridLayout_PlaceGroup(self, layoutGroup, groupNumber, ...) |
layoutGroup = layoutGroup.frame; |
ZappOGridCursor:SetFrameRef(tostring(layoutGroup), layoutGroup) |
ZappOGridCursor:Execute(([[ |
local index, group = %d, %q]]):format(groupNumber, tostring(layoutGroup)).."\n"..[[ |
groups[index] = self:GetFrameRef(group) ]] |
) |
end |
|
local GridLayout_LoadLayout = GridLayout.LoadLayout |
function GridLayout:LoadLayout(layoutName, ...) |
ZappOGridCursor:Execute[[ |
groups = table.wipe(groups or table.new()); |
]] |
GridLayout_LoadLayout(self, layoutName, ...) |
local placeOne = self[self.layoutSettings[layoutName][1].isPetGroup and "layoutPetGroups" or "layoutGroups"][1].frame:GetAttribute("child1") |
ZappOGridCursor:SetParent(placeOne) |
ZappOGridCursor:SetPoint("LEFT", placeOne, -3, 0) |
ZappOGridCursor:SetPoint("BOTTOM", placeOne, 0, -3) |
ZappOGridCursor:SetPoint("TOP", placeOne, 0, 3) |
ZappOGridCursor:SetPoint("RIGHT", placeOne, 3, 0) |
ZappOGridCursor:SetFrameLevel(placeOne:GetFrameLevel() + 1) |
end |