--------------------------------- Dreamlayout.lua --------------------------------- --local L = AceLibrary("AceLocale-2.2"):new("Buffalo2") -- show = true, hide = false local DREAM_LABELS = true -- white = true, yellow = false local DREAM_COLOR = true local function abbrev__index (self, key) local value = "" for c in key:gmatch("(%w)%w*") do value = value .. c end rawset(self, key, value) return value end local abbrev = setmetatable({}, { __index = abbrev__index }) Buffalo2.Templates.DreamlayoutBuffs = { author = "Skyboat", growHorizontalFirst = true, cols = 8, xPad = 10, yPad = 30, GetName = function(container) return "Dreamlayout - Buffs and Weapon Enchants" end, GetDescription = function(container) return "Dreamlayout Style - Player buffs" end, ContainsBuff = function(container, buff) if (buff.unitid == "player" and buff.filter == "HELPFUL") then return true else return false end end, Comparator = function(container, buff1, buff2) return true end, Buttons = { GetGhostColor = function(button) if (button.frame:GetName() == "Buffalo2_Button1_Frame" or button.frame:GetName() == "Buffalo2_Button2_Frame") then return 0.2, 0.2, 0.7, 0.7 else return 0.2, 0.7, 0.2, 0.7 end end, GetDurationString = function(button, buff) if (not buff.timeLeft) then return "" end local duration if (buff.timeLeft > 3600) then duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, true) return duration else duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, false) return duration end end, GetLabelString = function(button, buff) if (buff.unitid == "OH" or buff.unitid == "MH") then return buff.unitid end local name = buff.name return abbrev[name] end, OnButtonAdding = function(button) local background = button.background if (not background) then background = CreateFrame("Frame", button.frame:GetName().."_Background", button.frame) background:SetFrameStrata("BACKGROUND") background:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 1, edgeFile = "", edgeSize = 0, insets = {left = 0, right = 0, top = 0, bottom = 0} }) --background:SetBackdropColor(1, 0, 0, 1) background:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) background:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) button.background = background end background:Show() button.border:SetTexture("") background:SetFrameStrata("BACKGROUND") local icon = button.icon icon:SetTexCoord(0.09, 0.91, 0.09, 0.91) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", background, "TOPLEFT", 3, -3) icon:SetPoint("BOTTOMRIGHT", background, "BOTTOMRIGHT", -3, 3) end, OnButtonRemoval = function(button) button.background:Hide() button.border:SetTexture("Interface\Buttons\UI-Debuff-Overlays") local icon = button.icon icon:SetTexCoord(0, 1, 0, 1) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) icon:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) end, OnSetBuff = function(button, buff) if (buff.unitid == "MH") or (buff.unitid == "OH") then button.background:SetBackdropColor(0.5, 0.2, 0.85, 1) else button.background:SetBackdropColor(0, 0, 0, 0.6) end end, }, } Buffalo2.Templates.DreamlayoutWeaponBuffs = { author = "Nimbal", growHorizontalFirst = true, cols = 8, xPad = 10, yPad = 30, GetName = function(container) return "Dreamlayout - Weapon Enchants" end, GetDescription = function(container) return "Dreamlayout Style - Temporary weapon enchants" end, ContainsBuff = function(container, buff) if (buff.unitid == "MH" or buff.unitid == "OH") then return true else return false end end, Comparator = function(container, buff1, buff2) if (buff2.unitid == "MH") then return false elseif (buff2.unitid == "OH" and buff1.unitid ~= "MH") then return false else return true end end, Buttons = { GetGhostColor = function(button) if (button.frame:GetName() == "Buffalo2_Button1_Frame" or button.frame:GetName() == "Buffalo2_Button2_Frame") then return 0.2, 0.2, 0.7, 0.7 else return 0.2, 0.7, 0.2, 0.7 end end, GetDurationString = function(button, buff) if (not buff.timeLeft) then return "" end local duration if (buff.timeLeft > 3600) then duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, true) return duration else duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, false) return duration end end, GetLabelString = function(button, buff) if (buff.unitid == "OH" or buff.unitid == "MH") then return buff.unitid end local name = buff.name return abbrev[name] end, OnButtonAdding = function(button) local background = button.background if (not background) then background = CreateFrame("Frame", button.frame:GetName().."_Background", button.frame) background:SetFrameStrata("BACKGROUND") background:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 1, edgeFile = "", edgeSize = 0, insets = {left = 0, right = 0, top = 0, bottom = 0} }) --background:SetBackdropColor(1, 0, 0, 1) background:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) background:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) button.background = background end background:Show() button.border:SetTexture("") background:SetFrameStrata("BACKGROUND") local icon = button.icon icon:SetTexCoord(0.09, 0.91, 0.09, 0.91) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", background, "TOPLEFT", 3, -3) icon:SetPoint("BOTTOMRIGHT", background, "BOTTOMRIGHT", -3, 3) end, OnButtonRemoval = function(button) button.background:Hide() button.border:SetTexture("Interface\Buttons\UI-Debuff-Overlays") local icon = button.icon icon:SetTexCoord(0, 1, 0, 1) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) icon:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) end, OnSetBuff = function(button, buff) if (buff.unitid == "MH") or (buff.unitid == "OH") then button.background:SetBackdropColor(0.5, 0.2, 0.85, 1) else button.background:SetBackdropColor(0, 0, 0, 0.6) end end, }, } Buffalo2.Templates.DreamlayoutDebuffs = { author = "Skyboat", growHorizontalFirst = true, cols = 8, xPad = 10, yPad = 30, GetName = function(container) return "Dreamlayout - Debuffs" end, GetDescription = function(container) return "Dreamlayout Style - Displays player debuffs" end, ContainsBuff = function(container, buff) if (buff.unitid == "player" and buff.filter == "HARMFUL") then return true else return false end end, Buttons = { GetGhostColor = function(button) return 0.7, 0.2, 0.2, 0.7 end, GetDurationString = function(button, buff) if (not buff.timeLeft) then return "" end local duration if (buff.timeLeft > 3600) then duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, true) return duration else duration = Buffalo2.abacus:FormatDurationCondensed(buff.timeLeft, DREAM_COLOR, false) return duration end end, GetLabelString = function(button, buff) if (buff.unitid == "OH" or buff.unitid == "MH") then return buff.unitid end local name = buff.name return abbrev[name] end, OnButtonAdding = function(button) local background = button.background if (not background) then background = CreateFrame("Frame", button.frame:GetName().."_Background", button.frame) background:SetFrameStrata("BACKGROUND") background:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 1, edgeFile = "", edgeSize = 0, insets = {left = 0, right = 0, top = 0, bottom = 0} }) --background:SetBackdropColor(1, 0, 0, 1) background:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) background:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) button.background = background end background:Show() button.border:SetTexture("") background:SetFrameStrata("BACKGROUND") local icon = button.icon icon:SetTexCoord(0.09, 0.91, 0.09, 0.91) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", background, "TOPLEFT", 3, -3) icon:SetPoint("BOTTOMRIGHT", background, "BOTTOMRIGHT", -3, 3) end, OnButtonRemoval = function(button) button.background:Hide() button.border:SetTexture("Interface\Buttons\UI-Debuff-Overlays") local icon = button.icon icon:SetTexCoord(0, 1, 0, 1) icon:ClearAllPoints() icon:SetPoint("TOPLEFT", button.frame, "TOPLEFT", 0, 0) icon:SetPoint("BOTTOMRIGHT", button.frame, "BOTTOMRIGHT", 0, 0) end, OnSetBuff = function(button, buff) Buffalo2:Debug("OnSetBuff") if (buff.debuffType) then Buffalo2:Debug("debuffType is there") Buffalo2:Debug("debuffType is not nothing") debuffColor = DebuffTypeColor[buff.debuffType] debuffColor.a = 0.6 else Buffalo2:Debug("None") debuffColor = DebuffTypeColor["none"] end button.background:SetBackdropColor(debuffColor.r, debuffColor.g, debuffColor.b, debuffColor.a) --else -- button.background:SetBackdropColor(0, 0, 0, 0.6) end, }, } if (not DREAM_LABELS) then local tmpl = Buffalo2.Templates tmpl.DreamlayoutBuffs.Buttons.GetLabelString = nil tmpl.DreamlayoutBuffs.Buttons.GetLabelAnchor = nil tmpl.DreamlayoutDebuffs.Buttons.GetLabelString = nil tmpl.DreamlayoutDebuffs.Buttons.GetLabelAnchor = nil end