/
local childName = name |
local defaults = {} |
local options, db |
local _,class = UnitClass('player') |
local _G = _G |
local buttons = {} |
local defBars = { |
'Action','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight','Shapeshift','PetAction' ,'BonusAction' |
'Action', |
'BonusAction', |
'MultiBarRight', |
'MultiBarLeft', |
'MultiBarBottomRight', |
'MultiBarBottomLeft', |
'Shapeshift', |
'PetAction', |
} |
local privFrame = { |
} |
local bagButtons = { |
MainMenuBarBackpackButton, |
CharacterBag0Slot, |
CharacterBag1Slot, |
CharacterBag2Slot, |
CharacterBag3Slot, |
'CharacterBag3Slot', |
'CharacterBag2Slot', |
'CharacterBag1Slot', |
'CharacterBag0Slot', |
'MainMenuBarBackpackButton', |
} |
addon['MSQ'] = LibStub("Masque",true) |
if(addon['MSQ']) then addon['MSQGroup'] = addon['MSQ']:Group(name,name) end |
return (_G[bname] and privFrame[bname] == nil) and bname or ( type(privFrame[bname]) == 'string' and privFrame[bname] or name..bname.."Bar") |
end |
local function resizeDrag(self, lastbutton) |
local width = (addon['round'](12/self['db']['rows'],0) + .5) * lastbutton:GetWidth() |
local height = (self['db']['rows'] + .5) * lastbutton:GetHeight() |
_G[self:GetName().."drag"]:ClearAllPoints() |
_G[self:GetName().."drag"]:SetWidth(width) |
_G[self:GetName().."drag"]:SetHeight(height) |
_G[self:GetName().."drag"]:SetPoint("TOPLEFT", _G[self:GetName().."drag"]:GetParent(), "TOPLEFT", - lastbutton:GetWidth()/4,lastbutton:GetHeight()/4) |
end |
local function localButtons() |
wipe(buttons) |
-- wipe(buttons) |
local lastbutton |
for b = 1, #defBars do |
local barname = getBarname(defBars[b]) |
if(f) then |
if(defBars[b]=='Action' and not hooked[f]) then |
f:SetAttribute("actionpage",b) |
elseif(defBars[b]=='MultiBarRight' and not hooked[f]) then |
f:SetAttribute("actionpage",b) |
end |
f:SetFrameStrata("MEDIUM") |
f:SetParent(UIParent) |
if(defBars[b] == 'Action') then |
button:SetID(i) |
else |
button:SetID(0) |
-- button:SetID(0) |
end |
buttons[#buttons + 1] = button |
if(addon['MSQ'] and addon['MSQGroup']) then |
if(addon['MSQ'] and addon['MSQGroup'] and not buttons[button]) then |
buttons[button] = true |
addon['MSQGroup']:AddButton(button) |
end |
button:ClearAllPoints() |
end |
end |
end |
resizeDrag(f, lastbutton) |
end |
local f = _G[name.."MicroMenu"] or CreateFrame("Frame", name.."MicroMenu", UIParent) |
addDrag(f) |
local spr = 12/db['bars'][f:GetName()]['rows'] |
lastbutton = f |
local y,row = 1,0 |
end |
end |
end |
resizeDrag(f, lastbutton) |
f = _G[name.."BagBar"] or CreateFrame("Frame", name.."BagBar", UIParent) |
addDrag(f) |
local spr = 12/db['bars'][f:GetName()]['rows'] |
local y,row = 1,0 |
for i = 1, #bagButtons do |
local btn = _G[bagButtons[i]] |
print(i,bagButtons[i], btn) |
if(btn) then |
UIPARENT_MANAGED_FRAME_POSITIONS[btn:GetName()] = nil |
btn:SetParent(f) |
btn:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT") |
end |
y = y + 1 |
if(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 |
end |
end |
end |
resizeDrag(f, lastbutton) |
if(BonusActionBarFrame:IsVisible()) then |
for i = 1, 12 do |
_G["ActionButton"..i]:SetAlpha(class == 'WARRIOR' and 1 or 0) |
_G["ActionButton"..i]:EnableMouse(class=='WARRIOR') |
end |
end |
end |
local function getBarPref(pref) |
localButtons() |
end |
local function resetCenter(pref) |
_G[pref[#pref-1]]:center() |
end |
local function buildPrefs() |
for b = 1, #defBars do |
local bname = getBarname(defBars[b]) |
}, addon['options']['args'][childName]) |
addon['AddConfigEntry'](addon, name, 'range', 'rows', 'Rows', 'Number of rows', 0,1,12,1,false,o) |
addon['AddConfigEntry'](addon, name, 'range', 'scale', 'Scale', 'Scale of this bar', 1,0.1,3,0.1,true,o) |
addon['AddConfigEntry'](addon, name, 'execute', 'center', 'Center', 'Reset position', 2,resetCenter,nil,nil,nil,o) |
end |
local o = addon['AddConfigMenu'](addon, { |
['name'] = name.."MicroMenu", |