1. guSB = CreateFrame("Frame","guSB")
  2. guSB:SetScript("OnEvent", function(self, event, ...)
  3.     self[event](self, event, ...)
  4. end)
  5. guSB:RegisterEvent("ADDON_LOADED")
  6.  
  7. local buffs = {}
  8. local debuffs = {}
  9. local wench = {}
  10. local auras = {wench,buffs,debuffs}
  11. local buffs_anchor, debuffs_anchor, cons_frame
  12.  
  13. local cons_num, cons_btn
  14. local consolidatedbtn = {}
  15. local consolidated = {}
  16.  
  17. local arset = {}
  18.  
  19. local defaults = {
  20.     buffs_point = "TOPRIGHT",
  21.     buffs_x = -150,
  22.     buffs_y = -10,
  23.     debuffs_point = "TOPRIGHT",
  24.     debuffs_x = -133,
  25.     debuffs_y = -138,
  26.     growthy = "BOTTOM",
  27.     growthx = "LEFT",
  28.     orientation = "HORIZONTAL",
  29.     maxlength = 16,
  30.     gap = 5,
  31.     width = 30,
  32.     height = 25,
  33.     hideblizzard = true,
  34.     consolidate = true,
  35. }
  36.  
  37. local function Flip(p1,x,y)
  38.     local p2 = ""
  39.     local dir
  40.     if p1 == "CENTER" then return "CENTER" end
  41.         if string.find(p1,"TOP") then p2 = p2..(y and "BOTTOM" or "TOP")end
  42.         if string.find(p1,"BOTTOM") then p2 = p2..(y and "TOP" or "BOTTOM") end
  43.         if string.find(p1,"LEFT") then p2 = p2..(x and "RIGHT" or "LEFT") end
  44.         if string.find(p1,"RIGHT") then p2 = p2..(x and "LEFT" or "RIGHT") end
  45.     if p2 == "RIGHT" or p2 == "LEFT" then
  46.         dir = "HORIZONTAL"
  47.     elseif p2 == "TOP" or p2 == "BOTTOM" then
  48.         dir = "VERTICAL"
  49.     end
  50.     return p2, dir
  51. end
  52.  
  53. function guSB.ADDON_LOADED(self,event,arg1)
  54.     if arg1 == "guSmallBuffs" then
  55.         gusbDB = gusbDB or {}
  56.         gusbDB.cons_ids = gusbDB.cons_ids or {}
  57.         gusbDB = setmetatable(gusbDB,{ __index = function(t,k) return defaults[k] end})
  58.        
  59.         guSB:UpdateLayoutSettings()
  60.         buffs_anchor = self:CreateAnchor("buffs")
  61.         debuffs_anchor = self:CreateAnchor("debuffs")
  62.        
  63.         guSB:RegisterEvent("UNIT_AURA")
  64.         if gusbDB.hideblizzard then
  65.             BuffFrame:UnregisterEvent("UNIT_AURA")
  66.             BuffFrame:Hide()
  67.             ConsolidatedBuffs.Show = ConsolidatedBuffs.Hide
  68.             ConsolidatedBuffs:Hide()
  69.             TemporaryEnchantFrame:Hide()
  70.         end
  71.        
  72.         if gusbDB.consolidate then
  73.             cons_btn = guSB:MakeConsButton()
  74.             table.insert(auras, 1, consolidatedbtn)
  75.             table.insert(auras, consolidated)
  76.             consolidatedbtn[1] = cons_btn
  77.             cons_frame = guSB:MakeConsolidatedFrame(cons_btn)
  78.         end
  79.         guSB.CheckWeaponEnchants(self)
  80.         guSB:UNIT_AURA(nil, "player")
  81.        
  82.         SLASH_GUSB1= "/gusb"
  83.         SLASH_GUSB2= "/gusmallbuffs"
  84.         SlashCmdList["GUSB"] = guSB.SlashCmd
  85.     end
  86. end
  87.  
  88. function guSB.UNIT_AURA(self, event, unit)
  89.     if unit ~= "player" then return end
  90.    
  91.     if gusbDB.consolidate then
  92.         cons_num = 0
  93.         for i,btn in pairs(consolidated) do
  94.             consolidated[i] = nil
  95.         end
  96.     end
  97.    
  98.     local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID
  99.     for i=1, BUFF_MAX_DISPLAY do
  100.         name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID = UnitAura("player",i,"HELPFUL")
  101.         if not name then
  102.             for j=i,BUFF_MAX_DISPLAY do
  103.                 if buffs[j] then buffs[j]:Hide()
  104.                 else break end
  105.             end
  106.             break
  107.         end
  108.        
  109.         if not buffs[i] then
  110.             local btn = self:CreateBuffIcon("buff")
  111.             btn.id = i
  112.             buffs[i] = btn
  113.         end
  114.        
  115.         local btn = buffs[i]
  116.         btn.icon:SetTexture(icon)
  117.         btn.bar:SetMinMaxValues(0, duration)
  118.         btn.count:SetText(count)
  119.         if count > 1 then btn.count:Show() else btn.count:Hide() end
  120.         btn.duration = duration
  121.         btn.expires = expires
  122.         btn.OnUpdateCounter = 1
  123.         btn:Show()
  124.         if btn.SetAttribute then
  125.     btn:SetAttribute("index", i)
  126. end
  127.         if gusbDB.consolidate then
  128.             if shouldConsolidate then
  129.                 consolidated[i] = btn
  130.                 btn:SetParent(cons_frame)
  131.                 cons_num = cons_num + 1
  132.             else
  133.                 btn:SetParent(UIParent)
  134.             end
  135.         end
  136.     end
  137.     for i=1, DEBUFF_MAX_DISPLAY do
  138.         name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID = UnitAura("player",i,"HARMFUL")
  139.         if not name then
  140.             for j=i,DEBUFF_MAX_DISPLAY do
  141.                 if debuffs[j] then debuffs[j]:Hide()
  142.                 else break end
  143.             end
  144.             break
  145.         end
  146.        
  147.         if not debuffs[i] then
  148.             local btn = self:CreateBuffIcon("debuff")
  149.             btn.id = i
  150.             debuffs[i] = btn
  151.         end
  152.        
  153.         local btn = debuffs[i]
  154.         btn.icon:SetTexture(icon)
  155.             local color
  156.             if ( dispelType ) then
  157.                 color = DebuffTypeColor[dispelType];
  158.             else
  159.                 color = DebuffTypeColor["none"];
  160.             end
  161.             btn:SetBackdropColor(color.r,color.g,color.b)
  162.         btn.bar:SetMinMaxValues(0, duration)
  163.         btn.duration = duration
  164.         btn.count:SetText(count)
  165.         if count > 1 then btn.count:Show() else btn.count:Hide() end
  166.         btn.expires = expires
  167.         btn.OnUpdateCounter = 1
  168.         btn:Show()
  169.     end
  170.     if gusbDB.consolidate then
  171.         cons_btn.count:SetText(cons_num)
  172.         if cons_num > 0 then cons_btn:Show() else cons_btn:Hide() end
  173.         if cons_frame:IsShown() then cons_frame:ResizeFrame() end
  174.     end
  175.     guSB:ArrangeIcons()
  176. end
  177.  
  178. function guSB.UpdateLayoutSettings(self)
  179.     arset.gxdir = (gusbDB.growthx == "LEFT" and -1 or 1)
  180.     arset.gydir = (gusbDB.growthy == "BOTTOM" and -1 or 1)
  181.     arset.stepx = (gusbDB.orientation == "HORIZONTAL" and 1 or 0) * arset.gxdir * gusbDB.gap
  182.     arset.stepy = (gusbDB.orientation == "VERTICAL" and 1 or 0) * arset.gydir * gusbDB.gap
  183.     arset.point = Flip(gusbDB.growthy..gusbDB.growthx, true, true)
  184.     arset.to = Flip(arset.point,(arset.stepx ~= 0),(arset.stepy ~= 0))
  185.     arset.newrowto = Flip(arset.point,(arset.stepy ~= 0),(arset.stepx ~= 0))
  186.     arset.max = gusbDB.maxlength
  187.  
  188.         for _, icons in pairs(auras) do
  189.             for id,btn in pairs(icons) do
  190.                 btn:SetWidth(gusbDB.width)
  191.                 btn:SetHeight(gusbDB.height)
  192.                 btn.icon:SetWidth(gusbDB.height)
  193.                 btn.icon:SetHeight(gusbDB.height)
  194.                 btn.bar:SetWidth(gusbDB.width - gusbDB.height - 2)
  195.                 btn.bar:SetHeight(gusbDB.height)
  196.                 btn:ClearAllPoints()
  197.             end
  198.         end
  199. end
  200.  
  201. function guSB.ArrangeIcons(self)
  202.     local prev, prevcol
  203.     local placed = 1
  204.     local gxdir = arset.gxdir
  205.     local gydir = arset.gydir
  206.     local stepx = arset.stepx
  207.     local stepy = arset.stepy
  208.     local point = arset.point
  209.     local to = arset.to
  210.     local newrowto = arset.newrowto
  211.     local max = arset.max
  212.     for _, icons in ipairs(auras) do
  213.         if icons == debuffs then
  214.             prev = debuffs_anchor
  215.             placed = 1
  216.         elseif icons == consolidated then
  217.             prev = cons_frame
  218.             max = 3
  219.             placed = 1
  220.         elseif not prev then
  221.             prev = buffs_anchor
  222.         end
  223.         for id,btn in pairs(icons) do
  224.  
  225.             local btn = icons[id]
  226.             if not btn:IsShown() then break end
  227.             if icons ~= buffs or not consolidated[id] then
  228.             if placed > 1 and select(2,math.modf((placed-1)/max)) == 0 then
  229.                 btn:SetPoint(point,prevcol,newrowto, math.abs(stepy)*gxdir, math.abs(stepx)*gydir )
  230.                 prevcol = btn
  231.             else
  232.                 if placed == 1 then prevcol = btn end
  233.                 btn:SetPoint(point,prev,to, stepx, stepy)
  234.             end
  235.             if placed == 1 and icons == consolidated then  
  236.                 btn:SetPoint(arset.point,cons_frame,arset.point,0,0)
  237.             end
  238.             placed = placed + 1
  239.             prev = btn
  240.             end
  241.         end
  242.     end
  243. end
  244.  
  245. local function AuraOnUpdate(self,time)
  246.         self.OnUpdateCounter = (self.OnUpdateCounter or 0) + time
  247.         if self.OnUpdateCounter < 0.2 then return end
  248.         self.OnUpdateCounter = 0
  249.         local left = self.expires - GetTime()
  250.         self.bar:SetValue(left)
  251.         local r,g,b
  252.         local duration = self.duration
  253.  
  254.         if duration == 0 and self.expires == 0 then
  255.             r,g,b = 1,0.5,0.9
  256.             self.bar:SetValue(1)
  257.         else
  258.             if left > duration / 2 then
  259.                 r,g,b = (duration - left)*2/duration, 1, 0
  260.             else
  261.                 r,g,b = 1, left*2/duration, 0
  262.             end
  263.         end
  264.         self.bar:SetStatusBarColor(r,g,b)
  265.         self.bar.bg:SetVertexColor(r/2,g/2,b/2)
  266. end
  267.  
  268. function guSB.CreateBuffIcon(self, auratype)
  269.     local backdrop = {
  270.         bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 0,
  271.         insets = {left = -2, right = -2, top = -2, bottom = -2},
  272.     }
  273.     local f = CreateFrame("Button",nil,UIParent, "SecureActionButtonTemplate")
  274.     local width = gusbDB.width
  275.     local height = gusbDB.height
  276.     f:SetWidth(width)
  277.     f:SetHeight(height)
  278.     f:SetBackdrop(backdrop)
  279.     f:SetBackdropColor(0, 0, 0, 0.7)
  280.  
  281.     f.icon = f:CreateTexture(nil,"ARTWORK")
  282.     f.icon:SetTexCoord(.07, .93, .07, .93)
  283.     f.icon:SetWidth(height)
  284.     f.icon:SetHeight(height)
  285.     f.icon:SetPoint("TOP", 0, 0)
  286.     f.icon:SetPoint("RIGHT", 0, 0)
  287.    
  288.     f.count  =  f:CreateFontString(nil, "OVERLAY")
  289.     f.count:SetFont("Fonts\\FRIZQT__.TTF",13,"OUTLINE")
  290.     f.count:SetJustifyH("RIGHT")
  291.     f.count:SetVertexColor(1,1,1)
  292.     f.count:SetPoint("BOTTOMRIGHT",f.icon,"BOTTOMRIGHT",0,0)
  293.     f.count:Hide()
  294.    
  295.     local bar = CreateFrame("StatusBar", nil, f)
  296.     bar:SetStatusBarTexture[[Interface\AddOns\guSmallBuffs\white.tga]]
  297.     bar:SetWidth(width - height - 2)
  298.     bar:SetHeight(height)
  299.     bar:SetOrientation("VERTICAL")
  300.     bar:SetMinMaxValues(0,100)
  301.     bar:SetValue(50)
  302.     bar:SetPoint("TOPLEFT",f,"TOPLEFT",0,0)
  303.     bar:SetStatusBarColor(1,0,0)
  304.     f.bar = bar
  305.    
  306.     local bbg =  bar:CreateTexture(nil,"BACKGROUND")
  307.     bbg:SetTexture[[Interface\AddOns\guSmallBuffs\white.tga]]
  308.     bbg:SetAllPoints(bar)  
  309.     bbg:SetVertexColor(0.4,0,0)
  310.     f.bar.bg = bbg
  311.    
  312. --f:EnableMouse(true)
  313. if auratype == "buff" then
  314.     f:RegisterForClicks("RightButtonUp")
  315.     --f:SetScript("OnClick",function(self,button)
  316.         --CancelUnitBuff("player", self.id, self.filter)
  317.     --end)
  318.     f:RegisterForClicks("RightButtonUp")
  319.     f.Secure = true
  320.    
  321.     -- Setup stuff for clicking off buffs
  322.     f:SetAttribute("type", "cancelaura" )
  323.     f:SetAttribute("unit", "player")
  324.     end
  325.    
  326.     f.filter = (auratype == "buff") and "HELPFUL" or "HARMFUL"
  327.     f:SetScript("OnEnter",function(self)
  328.         GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT")
  329.         GameTooltip:SetUnitAura("player", self.id, self.filter)
  330.     end)
  331.     f:SetScript("OnLeave",function(self)
  332.         GameTooltip:Hide()
  333.     end)
  334.    
  335.     f:SetScript("OnUpdate",AuraOnUpdate)
  336.    
  337.     f:Show()
  338.    
  339.     return f
  340. end
  341.  
  342. function guSB.CreateAnchor(self,tbl)
  343.     local f = CreateFrame("Button",nil,UIParent)
  344.     local width = gusbDB.width
  345.     local height = gusbDB.height
  346.     f:SetWidth(width)
  347.     f:SetHeight(height)
  348.     f:SetBackdrop({
  349.         bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 0,
  350.         insets = {left = -2, right = -2, top = -2, bottom = -2},
  351.     })
  352.     f:SetBackdropColor(0, 1, 0, 1)
  353.    
  354.     f:RegisterForDrag("LeftButton")
  355.     f:EnableMouse(true)
  356.     f:SetMovable(true)
  357.     f:SetFrameStrata("HIGH")
  358.     f:SetFrameLevel(2)
  359.     f:SetScript("OnDragStart",function(self) self:StartMoving() end)
  360.     f:SetScript("OnDragStop",function(self)
  361.         self:StopMovingOrSizing();
  362.         _,_, gusbDB[tbl.."_point"], gusbDB[tbl.."_x"], gusbDB[tbl.."_y"] = self:GetPoint(1)
  363.     end)
  364.  
  365.     f.SetPos = function(self,point, x, y )
  366.         gusbDB[tbl.."_point"] = point
  367.         gusbDB[tbl.."_x"] = x
  368.         gusbDB[tbl.."_y"] = y
  369.         self:ClearAllPoints()
  370.         self:SetPoint(point, UIParent, point, x, y)
  371.     end
  372.     f:SetPos(gusbDB[tbl.."_point"], gusbDB[tbl.."_x"], gusbDB[tbl.."_y"])
  373.    
  374.     f:Hide()
  375.    
  376.     return f
  377. end
  378.  
  379. function guSB.MakeConsolidatedFrame(self, cbtn)
  380.     local f = CreateFrame("Frame",nil,UIParent)
  381.     f:SetBackdrop({
  382.         bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 0,
  383.         insets = {left = -5, right = -5, top = -5, bottom = -5},
  384.     })
  385.     f:SetBackdropColor(0, 0, 0, 0.85)
  386.     f:SetFrameLevel(5)
  387.     f:SetPoint(arset.point,cbtn,Flip(arset.point, (arset.stepx == 0), (arset.stepy == 0)),0,0)
  388.     f:SetWidth(1)
  389.     f:SetHeight(1)
  390.     f.ResizeFrame = function(self)
  391.         local num = 0
  392.         local button = select(2,next(consolidated))
  393.         if not button then return end
  394.         for id, btn in pairs(consolidated) do
  395.             num = num + 1
  396.         end
  397.         local i,f = math.modf(num/3)
  398.         local hr = i + (f > 0 and 1 or 0)
  399.         local wr = i > 0 and 3 or num
  400.         local hf = (arset.stepx == 0) and "SetWidth" or "SetHeight"
  401.         local wf = (arset.stepx == 0) and "SetHeight" or "SetWidth"
  402.         local ghf = hf == "SetWidth" and "GetWidth" or "GetHeight"
  403.         local gwf = wf == "SetWidth" and "GetWidth" or "GetHeight"
  404.         self[hf](self,hr*button[ghf](button) + (hr-1)*gusbDB.gap)
  405.         self[wf](self,wr*button[gwf](button) + (wr-1)*gusbDB.gap)
  406.     end
  407.     f:SetScript("OnShow", f.ResizeFrame)
  408.     f.fadeOnUpdate = function(self,time)
  409.         self.timeElapsed = (self.timeElapsed or 0) + time
  410.         if self.timeElapsed > 3 then
  411.             self:Hide()
  412.             self:SetScript("OnUpdate",nil)
  413.             self.timeElapsed = 0
  414.         end
  415.     end
  416.     f:Hide()
  417.     return f
  418. end
  419. function guSB.MakeConsButton(self)
  420.     local btn = self:CreateBuffIcon("debuff")
  421.     btn.icon:SetTexture("Interface\\Buttons\\BuffConsolidation")
  422.     btn.icon:SetTexCoord(0.15, 0.35, 0.3, 0.7)
  423.     btn:SetScript("OnUpdate",nil)
  424.     btn:SetScript("OnEnter",function () cons_frame:Show(); end)
  425.     btn:SetScript("OnLeave",function () cons_frame:SetScript("OnUpdate",cons_frame.fadeOnUpdate) end)
  426.     btn.bar:SetStatusBarColor(1,0.5,0.5)
  427.     btn.bar:SetValue(100)
  428.     btn.count:Show()
  429.     btn:Show()
  430.    
  431.     return btn
  432. end
  433.  
  434. function guSB.MutateToWeaponEnchant(f, id)
  435.     f.id = id
  436.     f:SetBackdropColor(0.5,0.2,0.85,1)
  437.     f:SetScript("OnEnter",function(self)
  438.             GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
  439.             GameTooltip:SetInventoryItem("player", self.id)
  440.         end)
  441.     f:SetScript("OnClick",function(self)
  442.                 CancelItemTempEnchantment(self.id - 15);   -- should be 1 for mh
  443.                 guSB:CheckWeaponEnchants()
  444.         end)
  445.     f.duration = 3600
  446.     f.bar:SetMinMaxValues(0,f.duration)
  447.     f:Hide()
  448.    
  449.     return f
  450. end
  451.  
  452. function guSB.CheckWeaponEnchants(self)
  453.     local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges = GetWeaponEnchantInfo();
  454.     if ( hasOffHandEnchant ) then
  455.         if not wench[2] then
  456.             local btn = guSB:CreateBuffIcon("weapon")
  457.             guSB.MutateToWeaponEnchant(btn, 17)
  458.             wench[2] = btn
  459.         end
  460.         wench[2].icon:SetTexture(GetInventoryItemTexture("player", 17))
  461.         wench[2].expires = offHandExpiration/1000+GetTime()
  462.         if not wench[2]:IsShown()then
  463.             wench[2]:Show()
  464.             guSB:ArrangeIcons()
  465.         end
  466.     else
  467.         if wench[2] then if wench[2]:IsShown() then wench[2]:Hide() guSB:ArrangeIcons() end end
  468.     end
  469.     if ( hasMainHandEnchant ) then
  470.         if not wench[1] then
  471.             local btn = guSB:CreateBuffIcon("weapon")
  472.             guSB.MutateToWeaponEnchant(btn, 16)
  473.             wench[1] = btn
  474.         end
  475.         wench[1].icon:SetTexture(GetInventoryItemTexture("player", 16))
  476.         wench[1].expires = mainHandExpiration/1000+GetTime()
  477.         if not wench[1]:IsShown()then
  478.             wench[1]:Show()
  479.             guSB:ArrangeIcons()
  480.         end
  481.     else
  482.         if wench[1] then if wench[1]:IsShown() then wench[1]:Hide() guSB:ArrangeIcons() end end
  483.     end
  484. end
  485.  
  486. CreateFrame("Frame",nil):SetScript("OnUpdate",function(self,time)
  487.     self.OnUpdateCounter = (self.OnUpdateCounter or 1) + time
  488.     if self.OnUpdateCounter < 1 then return end
  489.     self.OnUpdateCounter = 0
  490.    
  491.     guSB:CheckWeaponEnchants()
  492. end)
  493.  
  494.  
  495.  
  496. local ParseOpts = function(str)
  497.     local fields = {}
  498.     for opt,args in string.gmatch(str,"(%w*)%s*=%s*([%w%,%-%_%.%:%\\%']+)") do
  499.         fields[opt:lower()] = tonumber(args) or string.upper(args)
  500.     end
  501.     return fields
  502. end
  503. function guSB.SlashCmd(msg)
  504.     k,v = string.match(msg, "([%w%+%-%=]+) ?(.*)")
  505.     if not k or k == "help" then print([[Usage:
  506.       |cffff99bb/gusb set|r width=26 height=20 growthx=left/right growthy=top/bottom maxlength=16 gap=5 orientation=vertical/horizontal
  507.       |cffff99bb/gusb opts|r : display current settings
  508.       |cffff99bb/gusb hideblizz|r
  509.       |cffff99bb/gusb consolidate|r
  510.       |cffff99bb/gusb lock|r
  511.       |cffff99bb/gusb unlock|r ]]
  512.     )end
  513.     if k == "opts" then
  514.         print ("Width: "..gusbDB.width)
  515.         print ("Height: "..gusbDB.height)
  516.         print ("Growth-X: "..gusbDB.growthx)
  517.         print ("Growth-Y: "..gusbDB.growthy)
  518.         print ("Orientation: "..gusbDB.orientation)
  519.         print ("Max length: "..gusbDB.maxlength)
  520.         print ("Gap: "..gusbDB.gap)
  521.         print ("Hide Blizzard frames: "..(gusbDB.hideblizzard and "true" or "false"))
  522.         print ("Consolidate Buffs: "..(gusbDB.consolidate and "true" or "false"))
  523.     end
  524.     if k == "set" then
  525.         local p = ParseOpts(v)
  526.         gusbDB.width = p["width"] or gusbDB.width
  527.         gusbDB.height = p["height"] or gusbDB.height
  528.         gusbDB.growthx = p["growthx"] or gusbDB.growthx
  529.         gusbDB.growthy = p["growthy"] or gusbDB.growthy
  530.         gusbDB.orientation = p["orientation"] or gusbDB.orientation
  531.         gusbDB.maxlength = p["maxlength"] or gusbDB.maxlength
  532.         gusbDB.gap = p["gap"] or gusbDB.gap
  533.         guSB:UpdateLayoutSettings()
  534.         guSB:ArrangeIcons()
  535.     end
  536.     if k == "hideblizz" then
  537.         gusbDB.hideblizzard = not gusbDB.hideblizzard
  538.         print('Changes will take effect after reloadui')
  539.     end
  540.     if k == "consolidate" then
  541.         gusbDB.consolidate = not gusbDB.consolidate
  542.         print("Consolidated Buffs "..(gusbDB.consolidate and "enabled" or "disabled"))
  543.         print('Changes will take effect after reloadui')
  544.     end
  545.     if k == "unlock" then
  546.         buffs_anchor:Show()
  547.         debuffs_anchor:Show()
  548.     end
  549.     if k == "lock" then
  550.         buffs_anchor:Hide()
  551.         debuffs_anchor:Hide()
  552.     end
  553. end