local options, db |
local _,class = UnitClass('player') |
local _G = _G |
local xoffset, yoffset = 4,4 |
local buttons = {} |
local xoffset, yoffset = 8,0 |
|
addon['MSQ'] = LibStub("Masque",true) |
if(addon['MSQ']) then addon['MSQGroup'] = addon['MSQ']:Group(name,name) end |
|
local function hideBlizz() |
local hide = { |
MainMenuBar, |
ReputationWatchBar, |
MainMenuExpBar, |
BonusActionBarFrame, |
BonusActionBarFrameTexture1, |
BonusActionBarFrameTexture2, |
BonusActionBarFrameTexture3, |
BonusActionBarFrameTexture4, |
} |
for i = 1, #hide do |
local f = hide[i] |
if(type(f.UnregisterAllEvents) == 'function') then f:UnregisterAllEvents() end |
f.Show = f.Hide |
f:Hide() |
end |
end |
|
local function applySettings(bname, bh) |
|
db = addon['updateDB'](addon['db']['profile']) |
local f = _G[bname] |
if(not f) then return end |
local spr = db['bars'][bname]['cols'] |
local y,row = 1,0 |
local lastbutton = f |
f:SetScale(db['bars'][bname]['scale']) |
if(f['sbuttons']) then |
for i = 1, #f['sbuttons'] do |
local btn = f['sbuttons'][i] |
bh = bh or btn:GetHeight() |
btn:SetParent(f) |
btn:ClearAllPoints() |
if(y == 1) then |
|
btn:SetPoint("TOPLEFT", f, "TOPLEFT",0 , -row * bh + yoffset) |
else |
btn:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT",xoffset,0) |
end |
y = y + 1 |
if(not f['skipMasque'] and addon['MSQ'] and addon['MSQGroup'] and not buttons[btn]) then |
buttons[btn] = true |
addon['MSQGroup']:AddButton(btn) |
end |
lastbutton = btn |
if(y > spr) then |
y = 1 |
row = row + 1 |
end |
end |
end |
if(row < 1) then row = 1 end |
if(db['bars'][bname]['cols'] > f['maxslots']) then db['bars'][bname]['cols'] = f['maxslots'] end |
bh = bh or 0 |
f:SetWidth(db['bars'][bname]['cols']*(lastbutton:GetWidth() + xoffset) -xoffset) |
f:SetHeight(row * (bh + yoffset) - yoffset) |
end |
addon['applySettings'] = applySettings |
local function getButton(parent, id, offset) |
local btn |
if(offset <= 12) then |
btn = _G['ActionButton'..id] |
elseif(offset <= 24) then |
|
elseif(offset <= 36) then |
btn = _G['MultiBarRightButton'..id] |
elseif(offset <= 48) then |
btn = _G['MultiBarLeftButton'..id] |
elseif(offset <= 60) then |
btn = _G['MultiBarBottomRightButton'..id] |
elseif(offset <= 72) then |
btn = _G['MultiBarBottomLeftButton'..id] |
elseif((offset > 190) and (offset <= 200)) then |
btn = _G['ShapeshiftButton'..id] |
elseif((offset > 200) and (offset <= 210)) then |
btn = _G['PetActionButton'..id] |
end |
|
if(not btn) then |
btn = CreateFrame("CheckButton", "$PARENTActionButton"..offset, parent, "ActionButtonTemplate ActionBarButtonCodeTemplate",id) |
btn['buttonType'] = "ZZACTIONBUTTON" |
else |
-- btn:GetParent():UnregisterAllEvents() |
btn:GetParent():Hide() |
btn:GetParent().Show = btn:GetParent().Hide |
btn:ClearAllPoints() |
btn:SetParent(parent) |
end |
-- print(parent, id, offset, btn:GetName()) |
return btn |
end |
|
local function createBar(bid,mb) |
mb = mb or 12 |
local yoff =-yoffset - 40 * (bid-1) |
local f = CreateFrame("Frame", "zzABar"..bid, UIParent, "SecureHandlerStateTemplate",bid == 1 and bid or nil) |
f['sbuttons'] = {} |
f['maxslots'] = mb |
local function createBar(bid) |
local f = CreateFrame("Frame", "zzABar"..bid, UIParent, "SecureHandlerStateTemplate",bid) |
f:SetWidth(1) |
f:SetHeight(1) |
f:SetPoint("CENTER", xoffset, yoff) |
if(bid > 1 and bid < 7) then |
f:SetAttribute('actionpage', bid) |
end |
if(bid == 1) then |
f:SetPoint("CENTER") |
f:SetAttribute('actionpage', bid) |
-- if(bid == 1) then |
f:SetAttribute('_onstate-page', [[ |
print(newstate) |
if(self:GetID() == 1) then |
self:SetAttribute('actionpage', newstate) |
control:ChildUpdate('actionpage', newstate) |
else |
control:ChildUpdate('actionpage', self:GetID()) |
end |
|
]]) |
f:SetAttribute('_onstate-possess', [[ |
if(self:GetID() == 1) then |
self:SetAttribute('actionpage', newstate) |
control:ChildUpdate('actionpage', newstate) |
else |
control:ChildUpdate('actionpage', self:GetID()) |
end |
]]) |
f:SetAttribute('_onstate-vehicle', [[ |
if(newstate == 'vehicle') then |
control:ChildUpdate('actionpage', self:GetID()) |
elseif(newstate == 'novehicle') then |
self:SetAttribute('actionpage', nil) |
control:ChildUpdate('actionpage', self:GetID()) |
end |
print(newstate, self:GetAttribute('action--old'),self:GetAttribute('actionpage')) |
]]) |
if(class == "WARRIOR") then |
RegisterStateDriver(f, "page", "[bonusbar:1] 7;[bonusbar:2] 8;[bonusbar:3] 9;1") |
elseif(class == "DRUID") then |