diff --git a/Interface/AddOns/SVUI/assets/artwork/Template/DEFAULT2.blp b/Interface/AddOns/SVUI/assets/artwork/Template/DEFAULT2.blp index f109633..a0c87d6 100644 Binary files a/Interface/AddOns/SVUI/assets/artwork/Template/DEFAULT2.blp and b/Interface/AddOns/SVUI/assets/artwork/Template/DEFAULT2.blp differ diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua index b1c6478..38b5900 100644 --- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua +++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua @@ -196,7 +196,14 @@ function MOD:CreateSuperBorders() TopPanel:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", -1, 1) TopPanel:Point("TOPRIGHT", SuperVillain.UIParent, "TOPRIGHT", 1, 1) TopPanel:Height(14) - TopPanel:SetBackdrop({bgFile = texture, edgeFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, tileSize = 0, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + TopPanel:SetBackdrop({ + bgFile = texture, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) TopPanel:SetBackdropColor(unpack(SuperVillain.Media.color.special)) TopPanel:SetBackdropBorderColor(0,0,0,1) TopPanel:SetFrameLevel(0) @@ -212,7 +219,14 @@ function MOD:CreateSuperBorders() BottomPanel:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", -1, -1) BottomPanel:Point("BOTTOMRIGHT", SuperVillain.UIParent, "BOTTOMRIGHT", 1, -1) BottomPanel:Height(14) - BottomPanel:SetBackdrop({bgFile = texture, edgeFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, tileSize = 0, edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + BottomPanel:SetBackdrop({ + bgFile = texture, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) BottomPanel:SetBackdropColor(unpack(SuperVillain.Media.color.special)) BottomPanel:SetBackdropBorderColor(0,0,0,1) BottomPanel:SetFrameLevel(0) @@ -344,7 +358,7 @@ function MOD:CreateDockPanels() if MOD.SuperDockFaded then LeftSuperDock:Hide()RightSuperDock:Hide() end local toolbarTop = CreateFrame("Button", "SuperDockToolBarTop", SuperVillain.UIParent) - toolbarTop:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -2) + toolbarTop:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 2, -4) toolbarTop:Size(1, buttonsize - 12) toolbarTop.openWidth = (leftWidth - 1) / 3; @@ -357,12 +371,12 @@ function MOD:CreateDockPanels() local topleftdata = CreateFrame("Frame", "TopLeftDataPanel", topanchor) topleftdata:Size(leftWidth - 1, buttonsize - 8) topleftdata:Point("LEFT", topanchor, "LEFT", 0, 0) - STATS:NewAnchor(topleftdata, 3, "ANCHOR_CURSOR", 17, -4) + STATS:NewAnchor(topleftdata, 3, "ANCHOR_CURSOR", true) local toprightdata = CreateFrame("Frame", "TopRightDataPanel", topanchor) toprightdata:Size(leftWidth - 1, buttonsize - 8) toprightdata:Point("RIGHT", topanchor, "RIGHT", 0, 0) - STATS:NewAnchor(toprightdata, 3, "ANCHOR_CURSOR", 17, -4) + STATS:NewAnchor(toprightdata, 3, "ANCHOR_CURSOR", true) --BOTTOM STAT HOLDERS local bottomanchor = CreateFrame("Frame", "SuperDockBottomDataAnchor", SuperVillain.UIParent) @@ -373,12 +387,12 @@ function MOD:CreateDockPanels() local bottomleftdata = CreateFrame("Frame", "BottomLeftDataPanel", bottomanchor) bottomleftdata:Size(leftWidth - 1, buttonsize - 8) bottomleftdata:Point("LEFT", bottomanchor, "LEFT", 0, 0) - STATS:NewAnchor(bottomleftdata, 3, "ANCHOR_CURSOR", 17, 4) + STATS:NewAnchor(bottomleftdata, 3, "ANCHOR_CURSOR") local bottomrightdata = CreateFrame("Frame", "BottomRightDataPanel", bottomanchor) bottomrightdata:Size(rightWidth - 1, buttonsize - 8) bottomrightdata:Point("RIGHT", bottomanchor, "RIGHT", 0, 0) - STATS:NewAnchor(bottomrightdata, 3, "ANCHOR_CURSOR", 17, 4) + STATS:NewAnchor(bottomrightdata, 3, "ANCHOR_CURSOR") end function MOD:ReLoad() diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.lua b/Interface/AddOns/SVUI/packages/stats/SVStats.lua index 8902f1e..063d1f1 100644 --- a/Interface/AddOns/SVUI/packages/stats/SVStats.lua +++ b/Interface/AddOns/SVUI/packages/stats/SVStats.lua @@ -4,11 +4,11 @@ _____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# ############################################################################## S U P E R - V I L L A I N - U I By: Munglunch # ############################################################################## @@ -37,7 +37,7 @@ local SuperVillain, L = unpack(select(2, ...)); local MOD = {}; MOD.Anchors = {}; MOD.Statistics = {}; -MOD.PlotPoints = {'middle','left','right'}; +MOD.PlotPoints = {"middle", "left", "right"}; MOD.tooltip = CreateFrame("GameTooltip", "StatisticTooltip", UIParent, "GameTooltipTemplate") --[[ ########################################################## @@ -51,7 +51,6 @@ local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS LOCAL VARIABLES ########################################################## ]]-- ---local LDB = LibStub:GetLibrary("LibDataBroker-1.1"); local hexString = "|cffFFFFFF"; local myName = UnitName("player"); local myClass = select(2,UnitClass("player")); @@ -64,495 +63,521 @@ local ListNeedsUpdate = true LOCAL FUNCTIONS ########################################################## ]]-- -local function GrabPlot(parent,slot,max) - if max==1 then - return'CENTER',parent,'CENTER' - else - if slot==1 then - return'CENTER',parent,'CENTER' - elseif slot==2 then - return'RIGHT',parent.holders['middle'],'LEFT',-4,0 - elseif slot==3 then - return'LEFT',parent.holders['middle'],'RIGHT',4,0 - end - end -end; +local function GrabPlot(parent, slot, max) + if max == 1 then + return"CENTER", parent, "CENTER" + else + if slot == 1 then + return"CENTER", parent, "CENTER" + elseif slot == 2 then + return "RIGHT", parent.holders["middle"], "LEFT", -4, 0 + elseif slot == 3 then + return"LEFT", parent.holders["middle"], "RIGHT", 4, 0 + end + end +end local UpdateAnchor = function() - for _,anchor in pairs(MOD.Anchors)do - local w=anchor:GetWidth() / anchor.numPoints - 4; - local h=anchor:GetHeight() - 4; - for i=1,anchor.numPoints do - local this=MOD.PlotPoints[i] - anchor.holders[this]:Width(w) - anchor.holders[this]:Height(h) - anchor.holders[this]:Point(GrabPlot(anchor,i,numPoints)) - end - end -end; + local backdrops = MOD.db.showBackground + for _, anchor in pairs(MOD.Anchors)do + local w = anchor:GetWidth() / anchor.numPoints - 4; + local h = anchor:GetHeight() - 4; + if(backdrops) then + h = RightSuperDockToggleButton:GetHeight() - 6 + end + for i = 1, anchor.numPoints do + local this = MOD.PlotPoints[i] + anchor.holders[this]:Width(w) + anchor.holders[this]:Height(h) + anchor.holders[this]:Point(GrabPlot(anchor, i, numPoints)) + end + end +end local _hook_TooltipOnShow = function(self) - self:SetBackdrop({ - bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - edgeSize = 1 - }) - self:SetBackdropColor(0, 0, 0, 0.8) - self:SetBackdropBorderColor(0, 0, 0) -end; + self:SetBackdrop({ + bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + edgeSize = 1 + }) + self:SetBackdropColor(0, 0, 0, 0.8) + self:SetBackdropBorderColor(0, 0, 0) +end local function TruncateString(value) - if value >= 1e9 then - return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e6 then - return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e3 or value <= -1e3 then - return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") - else - return value - end -end; + if value >= 1e9 then + return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") + else + return value + end +end --[[ ########################################################## CORE FUNCTIONS ########################################################## ]]-- -function MOD:Tip(f) - local p = f:GetParent() - MOD.tooltip:Hide() - MOD.tooltip:SetOwner(p,p.anchor,p.xOff,p.yOff) - MOD.tooltip:ClearLines() - GameTooltip:Hide() -end; +function MOD:Tip(stat) + local parent = stat:GetParent() + MOD.tooltip:Hide() + MOD.tooltip:SetOwner(parent, parent.anchor) + MOD.tooltip:ClearLines() + GameTooltip:Hide() +end function MOD:ShowTip(noSpace) - if(not noSpace) then - MOD.tooltip:AddLine(" ") - end - MOD.tooltip:AddDoubleLine("[Alt + Click]","Swap Stats",0,1,0, 0.5,1,0.5) - MOD.tooltip:Show() -end; + if(not noSpace) then + MOD.tooltip:AddLine(" ") + end + MOD.tooltip:AddDoubleLine("[Alt + Click]", "Swap Stats", 0, 1, 0, 0.5, 1, 0.5) + MOD.tooltip:Show() +end -function MOD:NewAnchor(parent, maxCount, tipAnchor, x, y) - ListNeedsUpdate = true - MOD.Anchors[parent:GetName()] = parent; - parent.holders = {}; - parent.numPoints = maxCount; - parent.xOff = x; - parent.yOff = y; - parent.anchor = tipAnchor; - for i = 1, maxCount do - local this = MOD.PlotPoints[i] - if not parent.holders[this] then - parent.holders[this] = CreateFrame("Button", "DataText"..i, parent) - parent.holders[this]:RegisterForClicks("AnyUp") - parent.holders[this].barframe = CreateFrame("Frame", nil, parent.holders[this]) - parent.holders[this].barframe:Point("TOPLEFT", parent.holders[this], "TOPLEFT", 24, 2) - parent.holders[this].barframe:Point("BOTTOMRIGHT", parent.holders[this], "BOTTOMRIGHT", 3, -2) - parent.holders[this].barframe:SetFrameLevel(parent.holders[this]:GetFrameLevel()-1) - parent.holders[this].barframe:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - tile = false, - tileSize = 0, - edgeSize = 2, - insets = {left = 0, right = 0, top = 0, bottom = 0} - }) - parent.holders[this].barframe:SetBackdropColor(0, 0, 0, 0.5) - parent.holders[this].barframe:SetBackdropBorderColor(0, 0, 0, 0.8) - parent.holders[this].barframe.icon = CreateFrame("Frame", nil, parent.holders[this].barframe) - parent.holders[this].barframe.icon:Point("TOPLEFT", parent.holders[this], "TOPLEFT", 0, 6) - parent.holders[this].barframe.icon:Point("BOTTOMRIGHT", parent.holders[this], "BOTTOMLEFT", 26, -6) - parent.holders[this].barframe.icon.texture = parent.holders[this].barframe.icon:CreateTexture(nil, "OVERLAY") - parent.holders[this].barframe.icon.texture:FillInner(parent.holders[this].barframe.icon, 2, 2) - parent.holders[this].barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\PLACEHOLDER") - parent.holders[this].barframe.bar = CreateFrame("StatusBar", nil, parent.holders[this].barframe) - parent.holders[this].barframe.bar:FillInner(parent.holders[this].barframe, 2, 2) - parent.holders[this].barframe.bar:SetStatusBarTexture(SuperVillain.Media.bar.default) - parent.holders[this].barframe.bg = parent.holders[this].barframe:CreateTexture(nil, "BORDER") - parent.holders[this].barframe.bg:FillInner(parent.holders[this].barframe, 2, 2) - parent.holders[this].barframe.bg:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - parent.holders[this].barframe.bg:SetGradient(unpack(SuperVillain.Media.gradient.dark)) - parent.holders[this].barframe.bar.extra = CreateFrame("StatusBar", nil, parent.holders[this].barframe.bar) - parent.holders[this].barframe.bar.extra:SetAllPoints() - parent.holders[this].barframe.bar.extra:SetStatusBarTexture(SuperVillain.Media.bar.default) - parent.holders[this].barframe.bar.extra:Hide() - parent.holders[this].barframe:Hide() - parent.holders[this].textframe = CreateFrame("Frame", nil, parent.holders[this]) - parent.holders[this].textframe:SetAllPoints(parent.holders[this]) - parent.holders[this].textframe:SetFrameStrata("HIGH") - parent.holders[this].text = parent.holders[this].textframe:CreateFontString(nil, "OVERLAY", nil, 7) - parent.holders[this].text:SetAllPoints() - parent.holders[this].text:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - parent.holders[this].text:SetJustifyH("CENTER") - parent.holders[this].text:SetJustifyV("middle") - end; - parent.holders[this].MenuList = {}; - parent.holders[this]:Point(GrabPlot(parent, i, maxCount)) - end; - parent:SetScript("OnSizeChanged", UpdateAnchor) - UpdateAnchor(parent) -end; +function MOD:NewAnchor(parent, maxCount, tipAnchor, isTop) + ListNeedsUpdate = true + MOD.Anchors[parent:GetName()] = parent; + parent.holders = {}; + parent.numPoints = maxCount; + parent.anchor = tipAnchor; + local template = isTop and "FramedTop" or "FramedBottom" + for i = 1, maxCount do + local this = MOD.PlotPoints[i] + if not parent.holders[this] then + parent.holders[this] = CreateFrame("Button", "DataText"..i, parent) + parent.holders[this]:RegisterForClicks("AnyUp") + parent.holders[this].barframe = CreateFrame("Frame", nil, parent.holders[this]) + if(MOD.db.showBackground) then + parent.holders[this].barframe:Point("TOPLEFT", parent.holders[this], "TOPLEFT", 24, -2) + parent.holders[this].barframe:Point("BOTTOMRIGHT", parent.holders[this], "BOTTOMRIGHT", -2, 2) + parent.holders[this]:SetFramedButtonTemplate(template) + else + parent.holders[this].barframe:Point("TOPLEFT", parent.holders[this], "TOPLEFT", 24, 2) + parent.holders[this].barframe:Point("BOTTOMRIGHT", parent.holders[this], "BOTTOMRIGHT", 2, -2) + parent.holders[this].barframe.bg = parent.holders[this].barframe:CreateTexture(nil, "BORDER") + parent.holders[this].barframe.bg:FillInner(parent.holders[this].barframe, 2, 2) + parent.holders[this].barframe.bg:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + parent.holders[this].barframe.bg:SetGradient(unpack(SuperVillain.Media.gradient.dark)) + end + parent.holders[this].barframe:SetFrameLevel(parent.holders[this]:GetFrameLevel()-1) + parent.holders[this].barframe:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + tile = false, + tileSize = 0, + edgeSize = 2, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) + parent.holders[this].barframe:SetBackdropColor(0, 0, 0, 0.5) + parent.holders[this].barframe:SetBackdropBorderColor(0, 0, 0, 0.8) + parent.holders[this].barframe.icon = CreateFrame("Frame", nil, parent.holders[this].barframe) + parent.holders[this].barframe.icon:Point("TOPLEFT", parent.holders[this], "TOPLEFT", 0, 6) + parent.holders[this].barframe.icon:Point("BOTTOMRIGHT", parent.holders[this], "BOTTOMLEFT", 26, -6) + parent.holders[this].barframe.icon.texture = parent.holders[this].barframe.icon:CreateTexture(nil, "OVERLAY") + parent.holders[this].barframe.icon.texture:FillInner(parent.holders[this].barframe.icon, 2, 2) + parent.holders[this].barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\PLACEHOLDER") + parent.holders[this].barframe.bar = CreateFrame("StatusBar", nil, parent.holders[this].barframe) + parent.holders[this].barframe.bar:FillInner(parent.holders[this].barframe, 2, 2) + parent.holders[this].barframe.bar:SetStatusBarTexture(SuperVillain.Media.bar.default) + + parent.holders[this].barframe.bar.extra = CreateFrame("StatusBar", nil, parent.holders[this].barframe.bar) + parent.holders[this].barframe.bar.extra:SetAllPoints() + parent.holders[this].barframe.bar.extra:SetStatusBarTexture(SuperVillain.Media.bar.default) + parent.holders[this].barframe.bar.extra:Hide() + parent.holders[this].barframe:Hide() + parent.holders[this].textframe = CreateFrame("Frame", nil, parent.holders[this]) + parent.holders[this].textframe:SetAllPoints(parent.holders[this]) + parent.holders[this].textframe:SetFrameStrata("HIGH") + parent.holders[this].text = parent.holders[this].textframe:CreateFontString(nil, "OVERLAY", nil, 7) + parent.holders[this].text:SetAllPoints() + if(MOD.db.showBackground) then + parent.holders[this].text:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, "NONE") + parent.holders[this].text:SetJustifyH("CENTER") + parent.holders[this].text:SetJustifyV("middle") + parent.holders[this].text:SetShadowColor(0, 0, 0, 0.5) + parent.holders[this].text:SetShadowOffset(2, -4) + else + parent.holders[this].text:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + parent.holders[this].text:SetJustifyH("CENTER") + parent.holders[this].text:SetJustifyV("middle") + end + end + parent.holders[this].MenuList = {}; + parent.holders[this]:Point(GrabPlot(parent, i, maxCount)) + end + parent:SetScript("OnSizeChanged", UpdateAnchor) + UpdateAnchor(parent) +end -function MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - if not newStat then return end; - MOD.Statistics[newStat]={} - if type(eventList)=='table'then - MOD.Statistics[newStat]['events']=eventList; - MOD.Statistics[newStat]['event_handler']=onEvents - end; - if update and type(update)=='function'then - MOD.Statistics[newStat]['update_handler']=update - end; - if click and type(click)=='function'then - MOD.Statistics[newStat]['click_handler']=click - end; - if focus and type(focus)=='function'then - MOD.Statistics[newStat]['focus_handler']=focus - end; - if blur and type(blur)=='function'then - MOD.Statistics[newStat]['blur_handler']=blur - end -end; +function MOD:Extend(newStat, eventList, onEvents, update, click, focus, blur, init) + if not newStat then return end + MOD.Statistics[newStat] = {} + if type(eventList) == "table" then + MOD.Statistics[newStat]["events"] = eventList; + MOD.Statistics[newStat]["event_handler"] = onEvents + end + if update and type(update) == "function" then + MOD.Statistics[newStat]["update_handler"] = update + end + if click and type(click) == "function" then + MOD.Statistics[newStat]["click_handler"] = click + end + if focus and type(focus) == "function" then + MOD.Statistics[newStat]["focus_handler"] = focus + end + if blur and type(blur) == "function" then + MOD.Statistics[newStat]["blur_handler"] = blur + end + if init and type(init) == "function" then + MOD.Statistics[newStat]["init_handler"] = init + end +end + +function MOD:UnSet(parent) + parent:UnregisterAllEvents() + parent:SetScript("OnUpdate", nil) + parent:SetScript("OnEnter", nil) + parent:SetScript("OnLeave", nil) + parent:SetScript("OnClick", nil) +end do - local dataLayout, dataStrings = {}, {"None",KILLING_BLOWS,HONORABLE_KILLS,DEATHS,HONOR,"None","None","None","None",DAMAGE,SHOW_COMBAT_HEALING}; - dataLayout["TopLeftDataPanel"] = {true,true,true}; - dataLayout["TopLeftDataPanel"]['left'] = 10; - dataLayout["TopLeftDataPanel"]['middle'] = 5; - dataLayout["TopLeftDataPanel"]['right'] = 2; - dataLayout["TopRightDataPanel"] = {true,true,true}; - dataLayout["TopRightDataPanel"]['left'] = 4; - dataLayout["TopRightDataPanel"]['middle'] = 3; - dataLayout["TopRightDataPanel"]['right'] = 11; - local Stat_OnLeave = function() - MOD.tooltip:Hide() - end + local dataLayout, dataStrings = {}, {"None",KILLING_BLOWS,HONORABLE_KILLS,DEATHS,HONOR,"None","None","None","None",DAMAGE,SHOW_COMBAT_HEALING}; + dataLayout["TopLeftDataPanel"] = {true,true,true}; + dataLayout["TopLeftDataPanel"]['left'] = 10; + dataLayout["TopLeftDataPanel"]['middle'] = 5; + dataLayout["TopLeftDataPanel"]['right'] = 2; + dataLayout["TopRightDataPanel"] = {true,true,true}; + dataLayout["TopRightDataPanel"]['left'] = 4; + dataLayout["TopRightDataPanel"]['middle'] = 3; + dataLayout["TopRightDataPanel"]['right'] = 11; + local Stat_OnLeave = function() + MOD.tooltip:Hide() + end - local DD_OnClick = function(self) - self.func() - self:GetParent():Hide() - end + local DD_OnClick = function(self) + self.func() + self:GetParent():Hide() + end - local DD_OnEnter = function(self) - self.hoverTex:Show() - end + local DD_OnEnter = function(self) + self.hoverTex:Show() + end - local DD_OnLeave = function(self) - self.hoverTex:Hide() - end + local DD_OnLeave = function(self) + self.hoverTex:Hide() + end - local function _locate(parent) - local centerX,centerY = parent:GetCenter() - local screenWidth = GetScreenWidth() - local screenHeight = GetScreenHeight() - local result; - if not centerX or not centerY then - return "CENTER" - end; - local heightTop = screenHeight * 0.75; - local heightBottom = screenHeight * 0.25; - local widthLeft = screenWidth * 0.25; - local widthRight = screenWidth * 0.75; - if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then - result="TOP" - elseif((centerX < widthLeft) and (centerY > heightTop)) then - result="TOPLEFT" - elseif((centerX > widthRight) and (centerY > heightTop)) then - result="TOPRIGHT" - elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then - result="BOTTOM" - elseif((centerX < widthLeft) and (centerY < heightBottom)) then - result="BOTTOMLEFT" - elseif((centerX > widthRight) and (centerY < heightBottom)) then - result="BOTTOMRIGHT" - elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then - result="LEFT" - elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then - result="RIGHT" - else - result="CENTER" - end; - return result - end + local function _locate(parent) + local centerX, centerY = parent:GetCenter() + local screenWidth = GetScreenWidth() + local screenHeight = GetScreenHeight() + local result; + if not centerX or not centerY then + return "CENTER" + end + local heightTop = screenHeight * 0.75; + local heightBottom = screenHeight * 0.25; + local widthLeft = screenWidth * 0.25; + local widthRight = screenWidth * 0.75; + if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then + result = "TOP" + elseif((centerX < widthLeft) and (centerY > heightTop)) then + result = "TOPLEFT" + elseif((centerX > widthRight) and (centerY > heightTop)) then + result = "TOPRIGHT" + elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then + result = "BOTTOM" + elseif((centerX < widthLeft) and (centerY < heightBottom)) then + result = "BOTTOMLEFT" + elseif((centerX > widthRight) and (centerY < heightBottom)) then + result = "BOTTOMRIGHT" + elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then + result = "LEFT" + elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then + result = "RIGHT" + else + result = "CENTER" + end + return result + end - function MOD:SetStatMenu(self, list) - if not StatMenuFrame.buttons then - StatMenuFrame.buttons = {} - StatMenuFrame:SetFrameStrata("DIALOG") - StatMenuFrame:SetClampedToScreen(true) - tinsert(UISpecialFrames, StatMenuFrame:GetName()) - StatMenuFrame:Hide() - end - local maxPerColumn = 25 - local cols = 1 - for i=1, #StatMenuFrame.buttons do - StatMenuFrame.buttons[i]:Hide() - end - for i=1, #list do - if not StatMenuFrame.buttons[i] then - StatMenuFrame.buttons[i] = CreateFrame("Button", nil, StatMenuFrame) - StatMenuFrame.buttons[i].hoverTex = StatMenuFrame.buttons[i]:CreateTexture(nil, 'OVERLAY') - StatMenuFrame.buttons[i].hoverTex:SetAllPoints() - StatMenuFrame.buttons[i].hoverTex:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]]) - StatMenuFrame.buttons[i].hoverTex:SetBlendMode("ADD") - StatMenuFrame.buttons[i].hoverTex:Hide() - StatMenuFrame.buttons[i].text = StatMenuFrame.buttons[i]:CreateFontString(nil, 'BORDER') - StatMenuFrame.buttons[i].text:SetAllPoints() - StatMenuFrame.buttons[i].text:SetFont(SuperVillain.Media.font.roboto,12,"OUTLINE") - StatMenuFrame.buttons[i].text:SetJustifyH("LEFT") - StatMenuFrame.buttons[i]:SetScript("OnEnter", DD_OnEnter) - StatMenuFrame.buttons[i]:SetScript("OnLeave", DD_OnLeave) - end - StatMenuFrame.buttons[i]:Show() - StatMenuFrame.buttons[i]:SetHeight(16) - StatMenuFrame.buttons[i]:SetWidth(135) - StatMenuFrame.buttons[i].text:SetText(list[i].text) - StatMenuFrame.buttons[i].func = list[i].func - StatMenuFrame.buttons[i]:SetScript("OnClick", DD_OnClick) - if i == 1 then - StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame, "TOPLEFT", 10, -10) - elseif((i -1) % maxPerColumn == 0) then - StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame.buttons[i - maxPerColumn], "TOPRIGHT", 10, 0) - cols = cols + 1 - else - StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame.buttons[i - 1], "BOTTOMLEFT") - end - end - local maxHeight = (min(maxPerColumn, #list) * 16) + 20 - local maxWidth = (135 * cols) + (10 * cols) - StatMenuFrame:SetSize(maxWidth, maxHeight) - StatMenuFrame:ClearAllPoints() - local point = _locate(self:GetParent()) - if strfind(point, "BOTTOM") then - StatMenuFrame:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 10, 10) - else - StatMenuFrame:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 10, -10) - end - ToggleFrame(StatMenuFrame) - end + function MOD:SetStatMenu(self, list) + if not StatMenuFrame.buttons then + StatMenuFrame.buttons = {} + StatMenuFrame:SetFrameStrata("DIALOG") + StatMenuFrame:SetClampedToScreen(true) + tinsert(UISpecialFrames, StatMenuFrame:GetName()) + StatMenuFrame:Hide() + end + local maxPerColumn = 25 + local cols = 1 + for i=1, #StatMenuFrame.buttons do + StatMenuFrame.buttons[i]:Hide() + end + for i=1, #list do + if not StatMenuFrame.buttons[i] then + StatMenuFrame.buttons[i] = CreateFrame("Button", nil, StatMenuFrame) + StatMenuFrame.buttons[i].hoverTex = StatMenuFrame.buttons[i]:CreateTexture(nil, 'OVERLAY') + StatMenuFrame.buttons[i].hoverTex:SetAllPoints() + StatMenuFrame.buttons[i].hoverTex:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]]) + StatMenuFrame.buttons[i].hoverTex:SetBlendMode("ADD") + StatMenuFrame.buttons[i].hoverTex:Hide() + StatMenuFrame.buttons[i].text = StatMenuFrame.buttons[i]:CreateFontString(nil, 'BORDER') + StatMenuFrame.buttons[i].text:SetAllPoints() + StatMenuFrame.buttons[i].text:SetFont(SuperVillain.Media.font.roboto,12,"OUTLINE") + StatMenuFrame.buttons[i].text:SetJustifyH("LEFT") + StatMenuFrame.buttons[i]:SetScript("OnEnter", DD_OnEnter) + StatMenuFrame.buttons[i]:SetScript("OnLeave", DD_OnLeave) + end + StatMenuFrame.buttons[i]:Show() + StatMenuFrame.buttons[i]:SetHeight(16) + StatMenuFrame.buttons[i]:SetWidth(135) + StatMenuFrame.buttons[i].text:SetText(list[i].text) + StatMenuFrame.buttons[i].func = list[i].func + StatMenuFrame.buttons[i]:SetScript("OnClick", DD_OnClick) + if i == 1 then + StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame, "TOPLEFT", 10, -10) + elseif((i -1) % maxPerColumn == 0) then + StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame.buttons[i - maxPerColumn], "TOPRIGHT", 10, 0) + cols = cols + 1 + else + StatMenuFrame.buttons[i]:SetPoint("TOPLEFT", StatMenuFrame.buttons[i - 1], "BOTTOMLEFT") + end + end + local maxHeight = (min(maxPerColumn, #list) * 16) + 20 + local maxWidth = (135 * cols) + (10 * cols) + StatMenuFrame:SetSize(maxWidth, maxHeight) + StatMenuFrame:ClearAllPoints() + local point = _locate(self:GetParent()) + if strfind(point, "BOTTOM") then + StatMenuFrame:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 10, 10) + else + StatMenuFrame:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 10, -10) + end + ToggleFrame(StatMenuFrame) + end - local Parent_OnClick = function(self, button) - if IsAltKeyDown() then - MOD:SetStatMenu(self, self.MenuList); - elseif(self.onClick) then - if(StatMenuFrame:IsShown()) then - ToggleFrame(StatMenuFrame) - else - self.onClick(self, button); - end - end - end + local Parent_OnClick = function(self, button) + if IsAltKeyDown() then + MOD:SetStatMenu(self, self.MenuList); + elseif(self.onClick) then + if(StatMenuFrame:IsShown()) then + ToggleFrame(StatMenuFrame) + else + self.onClick(self, button); + end + end + end - local function _load(parent, config) - if config["events"]then - for _, event in pairs(config["events"])do - parent:RegisterEvent(event) - end - end; - if config["event_handler"]then - parent:SetScript("OnEvent", config["event_handler"]) - config["event_handler"](parent, "SVUI_FORCE_RUN") - end; - if config["update_handler"]then - parent:SetScript("OnUpdate", config["update_handler"]) - config["update_handler"](parent, 20000) - end; - if config["click_handler"]then - parent.onClick = config["click_handler"] - end - parent:SetScript("OnClick", Parent_OnClick) - if config["focus_handler"]then - parent:SetScript("OnEnter", config["focus_handler"]) - end; - if config["blur_handler"]then - parent:SetScript("OnLeave", config["blur_handler"]) - else - parent:SetScript("OnLeave", Stat_OnLeave) - end - end + local function _load(parent, config) + if config["events"]then + for _, event in pairs(config["events"])do + parent:RegisterEvent(event) + end + end + if config["event_handler"]then + parent:SetScript("OnEvent", config["event_handler"]) + config["event_handler"](parent, "SVUI_FORCE_RUN") + end + if config["update_handler"]then + parent:SetScript("OnUpdate", config["update_handler"]) + config["update_handler"](parent, 20000) + end + if config["click_handler"]then + parent.onClick = config["click_handler"] + end + parent:SetScript("OnClick", Parent_OnClick) + if config["focus_handler"]then + parent:SetScript("OnEnter", config["focus_handler"]) + end + if config["blur_handler"]then + parent:SetScript("OnLeave", config["blur_handler"]) + else + parent:SetScript("OnLeave", Stat_OnLeave) + end + parent:Show() + if config["init_handler"]then + config["init_handler"](parent) + end + end - local BGStatPrev; - local BG_OnUpdate = function(self) - BGStatPrev = self; - local truncated, tmp, bgName; - local parentName = BGStatPrev:GetParent():GetName(); - local lookup = BGStatPrev.pointIndex - local pointIndex = dataLayout[parentName][lookup] - local scoreType = dataStrings[pointIndex] - for index = 1, GetNumBattlefieldScores() do - bgName = GetBattlefieldScore(index) - if(bgName == myName) then - tmp = select(pointIndex, GetBattlefieldScore(index)) - truncated = TruncateString(tmp) - BGStatPrev.text:SetFormattedText(BGStatString, scoreType, truncated) - break - end - end - end + local BGStatPrev; + local BG_OnUpdate = function(self) + BGStatPrev = self; + local truncated, tmp, bgName; + local parentName = BGStatPrev:GetParent():GetName(); + local lookup = BGStatPrev.pointIndex + local pointIndex = dataLayout[parentName][lookup] + local scoreType = dataStrings[pointIndex] + for index = 1, GetNumBattlefieldScores() do + bgName = GetBattlefieldScore(index) + if(bgName == myName) then + tmp = select(pointIndex, GetBattlefieldScore(index)) + truncated = TruncateString(tmp) + BGStatPrev.text:SetFormattedText(BGStatString, scoreType, truncated) + break + end + end + end - local BG_OnEnter = function(self) - MOD:Tip(self) - local bgName; - local mapToken = GetCurrentMapAreaID() - local r, g, b; - if(classColor) then - r, g, b = classColor.r, classColor.g, classColor.b - else - r, g, b = 1, 1, 1 - end - for i = 1, GetNumBattlefieldScores() do - bgName = GetBattlefieldScore(i) - if(bgName and bgName == myName) then - MOD.tooltip:AddDoubleLine(L["Stats For:"], bgName, 1, 1, 1, r, g, b) - MOD.tooltip:AddLine(" ") - if(mapToken == 443 or mapToken == 626) then - MOD.tooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Flags Returned"], GetBattlefieldStatData(i, 2), 1, 1, 1) - elseif(mapToken == 482) then - MOD.tooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) - elseif(mapToken == 401) then - MOD.tooltip:AddDoubleLine(L["Graveyards Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Graveyards Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Towers Assaulted"], GetBattlefieldStatData(i, 3), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Towers Defended"], GetBattlefieldStatData(i, 4), 1, 1, 1) - elseif(mapToken == 512) then - MOD.tooltip:AddDoubleLine(L["Demolishers Destroyed"], GetBattlefieldStatData(i, 1), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Gates Destroyed"], GetBattlefieldStatData(i, 2), 1, 1, 1) - elseif(mapToken == 540 or mapToken == 736 or mapToken == 461) then - MOD.tooltip:AddDoubleLine(L["Bases Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Bases Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) - elseif(mapToken == 856) then - MOD.tooltip:AddDoubleLine(L["Orb Possessions"], GetBattlefieldStatData(i, 1), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Victory Points"], GetBattlefieldStatData(i, 2), 1, 1, 1) - elseif(mapToken == 860) then - MOD.tooltip:AddDoubleLine(L["Carts Controlled"], GetBattlefieldStatData(i, 1), 1, 1, 1) - end; - break - end - end; - MOD:ShowTip() - end + local BG_OnEnter = function(self) + MOD:Tip(self) + local bgName; + local mapToken = GetCurrentMapAreaID() + local r, g, b; + if(classColor) then + r, g, b = classColor.r, classColor.g, classColor.b + else + r, g, b = 1, 1, 1 + end + for i = 1, GetNumBattlefieldScores() do + bgName = GetBattlefieldScore(i) + if(bgName and bgName == myName) then + MOD.tooltip:AddDoubleLine(L["Stats For:"], bgName, 1, 1, 1, r, g, b) + MOD.tooltip:AddLine(" ") + if(mapToken == 443 or mapToken == 626) then + MOD.tooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Flags Returned"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 482) then + MOD.tooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) + elseif(mapToken == 401) then + MOD.tooltip:AddDoubleLine(L["Graveyards Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Graveyards Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Towers Assaulted"], GetBattlefieldStatData(i, 3), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Towers Defended"], GetBattlefieldStatData(i, 4), 1, 1, 1) + elseif(mapToken == 512) then + MOD.tooltip:AddDoubleLine(L["Demolishers Destroyed"], GetBattlefieldStatData(i, 1), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Gates Destroyed"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 540 or mapToken == 736 or mapToken == 461) then + MOD.tooltip:AddDoubleLine(L["Bases Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Bases Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 856) then + MOD.tooltip:AddDoubleLine(L["Orb Possessions"], GetBattlefieldStatData(i, 1), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Victory Points"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 860) then + MOD.tooltip:AddDoubleLine(L["Carts Controlled"], GetBattlefieldStatData(i, 1), 1, 1, 1) + end + break + end + end + MOD:ShowTip() + end - local ForceHideBGStats; - local BG_OnClick = function() - ForceHideBGStats = true; - MOD:Generate() - SuperVillain:AddonMessage(L["Battleground statistics temporarily hidden, to show type \"/sv bg\" or \"/sv pvp\""]) - end + local ForceHideBGStats; + local BG_OnClick = function() + ForceHideBGStats = true; + MOD:Generate() + SuperVillain:AddonMessage(L["Battleground statistics temporarily hidden, to show type \"/sv bg\" or \"/sv pvp\""]) + end - local function SetMenuLists() - for place,parent in pairs(MOD.Anchors)do - for h = 1, parent.numPoints do - local this = MOD.PlotPoints[h] - tinsert(parent.holders[this].MenuList,{text = NONE, func = function() MOD:ChangeDBVar(NONE, this, "panels", place); MOD:Generate() end}); - for name,config in pairs(MOD.Statistics)do - tinsert(parent.holders[this].MenuList,{text = name, func = function() MOD:ChangeDBVar(name, this, "panels", place); MOD:Generate() end}); - end - end - ListNeedsUpdate = false; - end - end; + local function SetMenuLists() + for place,parent in pairs(MOD.Anchors)do + for h = 1, parent.numPoints do + local this = MOD.PlotPoints[h] + tinsert(parent.holders[this].MenuList,{text = NONE, func = function() MOD:ChangeDBVar(NONE, this, "panels", place); MOD:Generate() end}); + for name,config in pairs(MOD.Statistics)do + tinsert(parent.holders[this].MenuList,{text = name, func = function() MOD:ChangeDBVar(name, this, "panels", place); MOD:Generate() end}); + end + end + ListNeedsUpdate = false; + end + end - function MOD:Generate() - if(ListNeedsUpdate) then - SetMenuLists() - end - local instance, groupType = IsInInstance() - for place, parent in pairs(MOD.Anchors)do - for h = 1, parent.numPoints do - local this = MOD.PlotPoints[h] - parent.holders[this]:UnregisterAllEvents() - parent.holders[this]:SetScript("OnUpdate", nil) - parent.holders[this]:SetScript("OnEnter", nil) - parent.holders[this]:SetScript("OnLeave", nil) - parent.holders[this]:SetScript("OnClick", nil) - parent.holders[this].text:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - parent.holders[this].text:SetText(nil) - if parent.holders[this].barframe then - parent.holders[this].barframe:Hide() - end; - parent.holders[this].pointIndex = this; - if place == "TopLeftDataPanel" and instance and groupType == "pvp" and not ForceHideBGStats and SuperVillain.db.SVStats.battleground then - parent.holders[this]:RegisterEvent("UPDATE_BATTLEFIELD_SCORE") - parent.holders[this]:SetScript("OnEvent", BG_OnUpdate) - parent.holders[this]:SetScript("OnEnter", BG_OnEnter) - parent.holders[this]:SetScript("OnLeave", Stat_OnLeave) - parent.holders[this]:SetScript("OnClick", BG_OnClick) - BG_OnUpdate(parent.holders[this]) - else - for name, config in pairs(MOD.Statistics)do - for k, l in pairs(SuperVillain.db.SVStats.panels)do - if l and type(l) == "table"then - if k == place and SuperVillain.db.SVStats.panels[k][this] and SuperVillain.db.SVStats.panels[k][this] == name then - _load(parent.holders[this], config) - end - elseif l and type(l) == "string"and l == name then - if SuperVillain.db.SVStats.panels[k] == name and k == place then - _load(parent.holders[this], config) - end - end - end - end - end - end - end; - if ForceHideBGStats then ForceHideBGStats = nil end - end + function MOD:Generate() + if(ListNeedsUpdate) then + SetMenuLists() + end + local instance, groupType = IsInInstance() + for place, parent in pairs(MOD.Anchors)do + for h = 1, parent.numPoints do + local this = MOD.PlotPoints[h] + parent.holders[this]:UnregisterAllEvents() + parent.holders[this]:SetScript("OnUpdate", nil) + parent.holders[this]:SetScript("OnEnter", nil) + parent.holders[this]:SetScript("OnLeave", nil) + parent.holders[this]:SetScript("OnClick", nil) + if(MOD.db.showBackground) then + parent.holders[this].text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, "NONE") + else + parent.holders[this].text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + end + + parent.holders[this].text:SetText(nil) + if parent.holders[this].barframe then + parent.holders[this].barframe:Hide() + end + parent.holders[this].pointIndex = this; + parent.holders[this]:Hide() + if place == "TopLeftDataPanel" and instance and groupType == "pvp" and not ForceHideBGStats and SuperVillain.db.SVStats.battleground then + parent.holders[this]:RegisterEvent("UPDATE_BATTLEFIELD_SCORE") + parent.holders[this]:SetScript("OnEvent", BG_OnUpdate) + parent.holders[this]:SetScript("OnEnter", BG_OnEnter) + parent.holders[this]:SetScript("OnLeave", Stat_OnLeave) + parent.holders[this]:SetScript("OnClick", BG_OnClick) + BG_OnUpdate(parent.holders[this]) + parent.holders[this]:Show() + else + for name, config in pairs(MOD.Statistics)do + for k, l in pairs(SuperVillain.db.SVStats.panels)do + if l and type(l) == "table"then + if k == place and SuperVillain.db.SVStats.panels[k][this] and SuperVillain.db.SVStats.panels[k][this] == name then + _load(parent.holders[this], config) + end + elseif l and type(l) == "string"and l == name then + if SuperVillain.db.SVStats.panels[k] == name and k == place then + _load(parent.holders[this], config) + end + end + end + end + end + end + end + if ForceHideBGStats then ForceHideBGStats = nil end + end - local BGStatColorUpdate = function() - BGStatString = join("","%s: ", hexString, "%s|r") - if BGStatPrev ~= nil then - BG_OnUpdate(BGStatPrev) - end - end; - SuperVillain.Registry:SetCallback(BGStatColorUpdate); -end; + local BGStatColorUpdate = function() + BGStatString = join("", "%s: ", hexString, "%s|r") + if BGStatPrev ~= nil then + BG_OnUpdate(BGStatPrev) + end + end + + SuperVillain.Registry:SetCallback(BGStatColorUpdate); +end --[[ ########################################################## BUILD FUNCTION / UPDATE ########################################################## ]]-- function MOD:ReLoad() - self:Generate() -end; + self:Generate() +end function MOD:Load() - hexString = SuperVillain:HexColor("highlight") or "|cffFFFFFF" - SVUI_Global["Accountant"] = SVUI_Global["Accountant"] or {}; - SVUI_Global["Accountant"][SuperVillain.realm] = SVUI_Global["Accountant"][SuperVillain.realm] or {}; - SVUI_Global["Accountant"][SuperVillain.realm]["gold"] = SVUI_Global["Accountant"][SuperVillain.realm]["gold"] or {}; - SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] or 0; - SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] or {}; - SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] or 738; + hexString = SuperVillain:HexColor("highlight") or "|cffFFFFFF" + SVUI_Global["Accountant"] = SVUI_Global["Accountant"] or {}; + SVUI_Global["Accountant"][SuperVillain.realm] = SVUI_Global["Accountant"][SuperVillain.realm] or {}; + SVUI_Global["Accountant"][SuperVillain.realm]["gold"] = SVUI_Global["Accountant"][SuperVillain.realm]["gold"] or {}; + SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] or 0; + SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"] or {}; + SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] or 738; - SuperVillain.Registry:RunTemp("SVStats") + SuperVillain.Registry:RunTemp("SVStats") - StatMenuFrame:SetParent(SuperVillain.UIParent); - StatMenuFrame:SetPanelTemplate("Transparent"); - StatMenuFrame:Hide() + StatMenuFrame:SetParent(SuperVillain.UIParent); + StatMenuFrame:SetPanelTemplate("Transparent"); + StatMenuFrame:Hide() MOD.tooltip:SetParent(SuperVillain.UIParent) - MOD.tooltip:SetFrameStrata("DIALOG") + MOD.tooltip:SetFrameStrata("DIALOG") MOD.tooltip:HookScript("OnShow", _hook_TooltipOnShow) self:Generate() self:RegisterEvent("PLAYER_ENTERING_WORLD", "Generate") end -SuperVillain.Registry:NewPackage(MOD, "SVStats"); - ---[[ -MAPID REFERENCE - -WSG=443 -TP=626 -AV=401 -SOTA=512 -IOC=540 -EOTS=482 -TBFG=736 -AB=461 -TOK=856 -SSM=860 -]]-- \ No newline at end of file +SuperVillain.Registry:NewPackage(MOD, "SVStats") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/experience.lua b/Interface/AddOns/SVUI/packages/stats/common/experience.lua index 773407b..eb72021 100644 --- a/Interface/AddOns/SVUI/packages/stats/common/experience.lua +++ b/Interface/AddOns/SVUI/packages/stats/common/experience.lua @@ -47,7 +47,7 @@ local function getUnitXP(unit) else return UnitXP(unit),UnitXPMax(unit) end -end; +end local function TruncateString(value) if value >= 1e9 then @@ -67,7 +67,7 @@ local function Experience_OnEvent(self, ...) self.text:SetJustifyH("CENTER") self.barframe:Hide() self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,SuperVillain.db.SVStats.fontOutline) - end; + end local f, g = getUnitXP("player") local h = GetXPExhaustion() local i = "" @@ -75,19 +75,24 @@ local function Experience_OnEvent(self, ...) i = format("%s - %d%% R:%s [%d%%]", TruncateString(f), f / g * 100, TruncateString(h), h / g * 100) else i = format("%s - %d%%", TruncateString(f), f / g * 100) - end; + end self.text:SetText(i) -end; +end local function ExperienceBar_OnEvent(self, ...) - if ((UnitLevel("player") ~= GetMaxPlayerLevel()) and not self.barframe:IsShown())then + if (UnitLevel("player") == GetMaxPlayerLevel())then + self:Hide() + MOD:UnSet(self) + return + end + if (not self.barframe:IsShown())then self.barframe:Show() self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-XP") self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,"NONE") - end; + end if not self.barframe.bar.extra:IsShown() then self.barframe.bar.extra:Show() - end; + end local k = self.barframe.bar; local f, g = getUnitXP("player") k:SetMinMaxValues(0, g) @@ -102,9 +107,9 @@ local function ExperienceBar_OnEvent(self, ...) else k.extra:SetMinMaxValues(0, 1) k.extra:SetValue(0) - end; + end self.text:SetText("") -end; +end local function Experience_OnEnter(self) MOD:Tip(self) @@ -116,9 +121,16 @@ local function Experience_OnEnter(self) MOD.tooltip:AddDoubleLine(L["Remaining:"], format(" %d (%d%% - %d "..L["Bars"]..")", g-f, (g-f) / g * 100, 20 * g-f / g), 1, 1, 1) if h then MOD.tooltip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", h, h / g * 100), 1, 1, 1) - end; + end MOD:ShowTip() -end; +end + +local function ExperienceBar_OnLoad(self) + if (UnitLevel("player") == GetMaxPlayerLevel())then + self:Hide() + MOD:UnSet(self) + end +end -MOD:Extend("Experience", StatEvents, Experience_OnEvent, nil, nil, Experience_OnEnter) -MOD:Extend("Experience Bar", StatEvents, ExperienceBar_OnEvent, nil, nil, Experience_OnEnter) \ No newline at end of file +MOD:Extend("Experience", StatEvents, Experience_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) +MOD:Extend("Experience Bar", StatEvents, ExperienceBar_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua index ec44d07..1f0ac6f 100644 --- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua +++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua @@ -594,8 +594,8 @@ local _hook_GameTooltip_OnTooltipSetSpell = function(self) end local _hook_GameTooltip_SetDefaultAnchor = function(self, parent) - if SuperVillain.db.SVTip.enable ~= true then return end - if self:GetAnchorType() ~= "ANCHOR_NONE" then return end + if SuperVillain.db.SVTip.enable ~= true then return end + if(self:GetAnchorType() ~= "ANCHOR_NONE") then return end if InCombatLockdown() and MOD.db.visibility.combat then self:Hide() return @@ -603,24 +603,9 @@ local _hook_GameTooltip_SetDefaultAnchor = function(self, parent) if parent then if(MOD.db.cursorAnchor) then self:SetOwner(parent, "ANCHOR_CURSOR") - if not GameTooltipStatusBar.anchoredToTop then - GameTooltipStatusBar:ClearAllPoints() - GameTooltipStatusBar:SetPoint("TOPLEFT", GameTooltip.SuperBorder, "TOPLEFT", 1, -1) - GameTooltipStatusBar:SetPoint("TOPRIGHT", GameTooltip.SuperBorder, "TOPRIGHT", -1, -1) - GameTooltipStatusBar.text:Point("CENTER", GameTooltipStatusBar, 0, 3) - GameTooltipStatusBar.anchoredToTop = true - end return else self:SetOwner(parent, "ANCHOR_NONE") - self:ClearAllPoints() - if GameTooltipStatusBar.anchoredToTop then - GameTooltipStatusBar:ClearAllPoints() - GameTooltipStatusBar:SetPoint("BOTTOMLEFT", GameTooltip.SuperBorder, "BOTTOMLEFT", 1, 1) - GameTooltipStatusBar:SetPoint("BOTTOMRIGHT", GameTooltip.SuperBorder, "BOTTOMRIGHT", -1, 1) - GameTooltipStatusBar.text:Point("CENTER", GameTooltipStatusBar, 0, -3) - GameTooltipStatusBar.anchoredToTop = nil - end end end if not SuperVillain:TestMovableMoved("SVUI_ToolTip_MOVE")then @@ -681,15 +666,42 @@ local TooltipModifierChangeHandler = function(self, event, mod) end end +local Override_BGColor = function(self, r, g, b, a) + if(b ~= 0 or (a and a ~= 0)) then + self:SetBackdropColor(0, 0, 0, 0) + self.SuperBorder:SetBackdropColor(0, 0, 0, 0.8) + end +end + +local Override_BorderColor = function(self, r, g, b, a) + if(b ~= 0 or (a and a ~= 0)) then + self:SetBackdropBorderColor(0, 0, 0, 0) + self.SuperBorder:SetBackdropBorderColor(0, 0, 0) + end +end + function MOD:Load() BNToastFrame:Point("TOPRIGHT", SVUI_MinimapFrame, "BOTTOMLEFT", 0, -10) SuperVillain:SetSVMovable(BNToastFrame, "BNET_MOVE", L["BNet Frame"]) NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) if not SuperVillain.db.SVTip.enable then return end + + local anchor = CreateFrame("Frame", "GameTooltipAnchor", SuperVillain.UIParent) + anchor:Point("BOTTOMRIGHT", RightSuperDock, "TOPRIGHT", 0, 60) + anchor:Size(130, 20) + anchor:SetFrameLevel(anchor:GetFrameLevel() + 50) + SuperVillain:SetSVMovable(anchor, "SVUI_ToolTip_MOVE", L["Tooltip"]) + local barHeight = self.db.healthBar.height - local barOffset = barHeight + 6 + for _, tooltip in pairs(tooltips) do if(tooltip.SuperBorder) then return end + + local barOffset = 6 + if(tooltip == GameTooltip) then + barOffset = barHeight + 6 + end + local mask = CreateFrame("Frame", nil, tooltip) mask:SetPoint("TOPLEFT", tooltip, "TOPLEFT", 0, 0) mask:SetPoint("BOTTOMRIGHT", tooltip, "BOTTOMRIGHT", 0, -barOffset) @@ -717,29 +729,31 @@ function MOD:Load() mask[3]:SetVertexColor(0,0,0) mask[3]:SetBlendMode("BLEND") mask[3]:SetAlpha(0.8) - - tooltip:SetBackdrop({ + + mask:SetBackdrop({ bgFile = [[Interface\BUTTONS\WHITE8X8]], edgeFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, edgeSize = 1 }) - tooltip:SetBackdropColor(0, 0, 0, 0) - tooltip:SetBackdropBorderColor(0, 0, 0, 0) - tooltip.SetBackdrop = function() end - tooltip.SetBackdropColor = function() end - tooltip.SetBackdropBorderColor = function() end - tooltip:HookScript("OnShow", _hook_OnTipShow) + mask:SetBackdropColor(0, 0, 0, 0.8) + mask:SetBackdropBorderColor(0, 0, 0) - mask:SetBackdrop({ - bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], + tooltip.SuperBorder = mask + + tooltip:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], edgeFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, edgeSize = 1 }) - mask:SetBackdropColor(0, 0, 0, 0.8) - mask:SetBackdropBorderColor(0, 0, 0) - tooltip.SuperBorder = mask + tooltip:SetBackdropColor(0, 0, 0, 0) + tooltip:SetBackdropBorderColor(0, 0, 0, 0) + + tooltip.SetBackdrop = Override_BG + NewHook(tooltip, "SetBackdropColor", Override_BGColor) + NewHook(tooltip, "SetBackdropBorderColor", Override_BorderColor) + tooltip:HookScript("OnShow", _hook_OnTipShow) end GameTooltipStatusBar:Height(barHeight) @@ -751,7 +765,7 @@ function MOD:Load() GameTooltipStatusBar.text = GameTooltipStatusBar:CreateFontString(nil, "OVERLAY") GameTooltipStatusBar.text:Point("CENTER", GameTooltipStatusBar, "CENTER", 0, 0) GameTooltipStatusBar.text:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.healthBar.font), MOD.db.healthBar.fontSize, "OUTLINE") - + if not GameTooltipStatusBar.border then local border = CreateFrame("Frame", nil, GameTooltipStatusBar) border:WrapOuter(GameTooltipStatusBar, 1, 1) @@ -761,12 +775,6 @@ function MOD:Load() GameTooltipStatusBar.border = border end - local anchor = CreateFrame("Frame", "GameTooltipAnchor", SuperVillain.UIParent) - anchor:Point("BOTTOMRIGHT", RightSuperDock, "TOPRIGHT", 0, 60) - anchor:Size(130, 20) - anchor:SetFrameLevel(anchor:GetFrameLevel() + 50) - SuperVillain:SetSVMovable(anchor, "SVUI_ToolTip_MOVE", L["Tooltip"]) - NewHook("GameTooltip_SetDefaultAnchor", _hook_GameTooltip_SetDefaultAnchor) NewHook("GameTooltip_ShowStatusBar", _hook_GameTooltip_ShowStatusBar) NewHook("GameTooltip_ShowCompareItem", _hook_GameTooltip_ShowCompareItem) diff --git a/Interface/AddOns/SVUI/scripts/mounts.lua b/Interface/AddOns/SVUI/scripts/mounts.lua index 66b11ed..f5e625a 100644 --- a/Interface/AddOns/SVUI/scripts/mounts.lua +++ b/Interface/AddOns/SVUI/scripts/mounts.lua @@ -50,49 +50,54 @@ LOCAL FUNCTIONS local function UpdateMountCheckboxes(button, index) local _, creatureName = GetCompanionInfo("MOUNT", index); - button["GROUND"].index = index - button["GROUND"].name = creatureName - button["FLYING"].index = index - button["FLYING"].name = creatureName - button["SWIMMING"].index = index - button["SWIMMING"].name = creatureName - button["SPECIAL"].index = index - button["SPECIAL"].name = creatureName + local n = button.MountBar + local bar = _G[n] - if(SVUI_Cache.Mounts.names["GROUND"] == creatureName) then - if(SVUI_Cache.Mounts.types["GROUND"] ~= index) then - SVUI_Cache.Mounts.types["GROUND"] = index + if(bar) then + bar["GROUND"].index = index + bar["GROUND"].name = creatureName + bar["FLYING"].index = index + bar["FLYING"].name = creatureName + bar["SWIMMING"].index = index + bar["SWIMMING"].name = creatureName + bar["SPECIAL"].index = index + bar["SPECIAL"].name = creatureName + + if(SVUI_Cache.Mounts.names["GROUND"] == creatureName) then + if(SVUI_Cache.Mounts.types["GROUND"] ~= index) then + SVUI_Cache.Mounts.types["GROUND"] = index + end + bar["GROUND"]:SetChecked(1) + else + bar["GROUND"]:SetChecked(0) end - button["GROUND"]:SetChecked(1) - else - button["GROUND"]:SetChecked(0) - end - if(SVUI_Cache.Mounts.names["FLYING"] == creatureName) then - if(SVUI_Cache.Mounts.types["FLYING"] ~= index) then - SVUI_Cache.Mounts.types["FLYING"] = index + if(SVUI_Cache.Mounts.names["FLYING"] == creatureName) then + if(SVUI_Cache.Mounts.types["FLYING"] ~= index) then + SVUI_Cache.Mounts.types["FLYING"] = index + end + bar["FLYING"]:SetChecked(1) + else + bar["FLYING"]:SetChecked(0) end - button["FLYING"]:SetChecked(1) - else - button["FLYING"]:SetChecked(0) - end - if(SVUI_Cache.Mounts.names["SWIMMING"] == creatureName) then - if(SVUI_Cache.Mounts.types["SWIMMING"] ~= index) then - SVUI_Cache.Mounts.types["SWIMMING"] = index + if(SVUI_Cache.Mounts.names["SWIMMING"] == creatureName) then + if(SVUI_Cache.Mounts.types["SWIMMING"] ~= index) then + SVUI_Cache.Mounts.types["SWIMMING"] = index + end + bar["SWIMMING"]:SetChecked(1) + else + bar["SWIMMING"]:SetChecked(0) end - button["SWIMMING"]:SetChecked(1) - else - button["SWIMMING"]:SetChecked(0) - end - if(SVUI_Cache.Mounts.names["SPECIAL"] == creatureName) then - if(SVUI_Cache.Mounts.types["SPECIAL"] ~= index) then - SVUI_Cache.Mounts.types["SPECIAL"] = index + if(SVUI_Cache.Mounts.names["SPECIAL"] == creatureName) then + if(SVUI_Cache.Mounts.types["SPECIAL"] ~= index) then + SVUI_Cache.Mounts.types["SPECIAL"] = index + end + bar["SPECIAL"]:SetChecked(1) + else + bar["SPECIAL"]:SetChecked(0) end - button["SPECIAL"]:SetChecked(1) - else - button["SPECIAL"]:SetChecked(0) end end @@ -204,7 +209,7 @@ local CheckButton_OnEnter = function(self) local index = self.name local key = self.key local r,g,b = self:GetBackdropColor() - GameTooltip:SetOwner(self,'ANCHOR_TOPLEFT',0,4) + GameTooltip:SetOwner(self, 'ANCHOR_TOPLEFT', 0, 20) GameTooltip:ClearLines() GameTooltip:AddLine(key,r,g,b) GameTooltip:AddLine("",1,1,0) @@ -248,77 +253,88 @@ local function SetMountCheckButtons() local scrollBar = _G["MountJournalListScrollFrameScrollBar"] local buttons = scrollFrame.buttons; for i = 1, #buttons do - local button = buttons[i]; - local width = (button:GetWidth() - 18) * 0.25 + local button = buttons[i] + local barWidth = button:GetWidth() + local width = (barWidth - 18) * 0.25 local height = 7 + local barName = ("SVUI_MountSelectBar%d"):format(i) + + local buttonBar = CreateFrame("Frame", barName, button) + buttonBar:SetPoint("BOTTOMLEFT", button, "BOTTOMLEFT", 0, 0) + buttonBar:SetSize(barWidth, height + 8) + buttonBar:SetFrameStrata("HIGH") + buttonBar:SetFrameLevel(99) + --[[ CREATE CHECKBOXES ]]-- - button["GROUND"] = CreateFrame("CheckButton", nil, button, "UICheckButtonTemplate") - button["GROUND"]:SetSize(width,height) - button["GROUND"]:SetPoint("BOTTOMLEFT", button, "BOTTOMLEFT", 6, 4) - button["GROUND"]:Formula409() - button["GROUND"]:SetCheckboxTemplate() - button["GROUND"]:SetPanelColor(0.2, 0.7, 0.1, 0.15) - button["GROUND"]:GetCheckedTexture():SetVertexColor(0.2, 0.7, 0.1, 1) - button["GROUND"].key = "GROUND" + buttonBar["GROUND"] = CreateFrame("CheckButton", nil, buttonBar, "UICheckButtonTemplate") + buttonBar["GROUND"]:SetSize(width,height) + buttonBar["GROUND"]:SetPoint("BOTTOMLEFT", buttonBar, "BOTTOMLEFT", 6, 4) + buttonBar["GROUND"]:Formula409() + buttonBar["GROUND"]:SetCheckboxTemplate() + buttonBar["GROUND"]:SetPanelColor(0.2, 0.7, 0.1, 0.15) + buttonBar["GROUND"]:GetCheckedTexture():SetVertexColor(0.2, 0.7, 0.1, 1) + buttonBar["GROUND"].key = "GROUND" if(enabled) then - button["GROUND"]:SetChecked(1) + buttonBar["GROUND"]:SetChecked(1) else - button["GROUND"]:SetChecked(0) + buttonBar["GROUND"]:SetChecked(0) end - button["GROUND"]:SetScript("OnClick", CheckButton_OnClick) - button["GROUND"]:SetScript("OnEnter", CheckButton_OnEnter) - button["GROUND"]:SetScript("OnLeave", CheckButton_OnLeave) + buttonBar["GROUND"]:SetScript("OnClick", CheckButton_OnClick) + buttonBar["GROUND"]:SetScript("OnEnter", CheckButton_OnEnter) + buttonBar["GROUND"]:SetScript("OnLeave", CheckButton_OnLeave) - button["FLYING"] = CreateFrame("CheckButton", nil, button, "UICheckButtonTemplate") - button["FLYING"]:SetSize(width,height) - button["FLYING"]:SetPoint("BOTTOMLEFT", button["GROUND"], "BOTTOMRIGHT", 2, 0) - button["FLYING"]:Formula409() - button["FLYING"]:SetCheckboxTemplate() - button["FLYING"]:SetPanelColor(1, 1, 0.2, 0.15) - button["FLYING"]:GetCheckedTexture():SetVertexColor(1, 1, 0.2, 1) - button["FLYING"].key = "FLYING" + buttonBar["FLYING"] = CreateFrame("CheckButton", nil, buttonBar, "UICheckButtonTemplate") + buttonBar["FLYING"]:SetSize(width,height) + buttonBar["FLYING"]:SetPoint("BOTTOMLEFT", buttonBar["GROUND"], "BOTTOMRIGHT", 2, 0) + buttonBar["FLYING"]:Formula409() + buttonBar["FLYING"]:SetCheckboxTemplate() + buttonBar["FLYING"]:SetPanelColor(1, 1, 0.2, 0.15) + buttonBar["FLYING"]:GetCheckedTexture():SetVertexColor(1, 1, 0.2, 1) + buttonBar["FLYING"].key = "FLYING" if(enabled) then - button["FLYING"]:SetChecked(1) + buttonBar["FLYING"]:SetChecked(1) else - button["FLYING"]:SetChecked(0) + buttonBar["FLYING"]:SetChecked(0) end - button["FLYING"]:SetScript("OnClick", CheckButton_OnClick) - button["FLYING"]:SetScript("OnEnter", CheckButton_OnEnter) - button["FLYING"]:SetScript("OnLeave", CheckButton_OnLeave) + buttonBar["FLYING"]:SetScript("OnClick", CheckButton_OnClick) + buttonBar["FLYING"]:SetScript("OnEnter", CheckButton_OnEnter) + buttonBar["FLYING"]:SetScript("OnLeave", CheckButton_OnLeave) - button["SWIMMING"] = CreateFrame("CheckButton", nil, button, "UICheckButtonTemplate") - button["SWIMMING"]:SetSize(width,height) - button["SWIMMING"]:SetPoint("BOTTOMLEFT", button["FLYING"], "BOTTOMRIGHT", 2, 0) - button["SWIMMING"]:Formula409() - button["SWIMMING"]:SetCheckboxTemplate() - button["SWIMMING"]:SetPanelColor(0.2, 0.42, 0.76, 0.15) - button["SWIMMING"]:GetCheckedTexture():SetVertexColor(0.2, 0.42, 0.76, 1) - button["SWIMMING"].key = "SWIMMING" + buttonBar["SWIMMING"] = CreateFrame("CheckButton", nil, buttonBar, "UICheckButtonTemplate") + buttonBar["SWIMMING"]:SetSize(width,height) + buttonBar["SWIMMING"]:SetPoint("BOTTOMLEFT", buttonBar["FLYING"], "BOTTOMRIGHT", 2, 0) + buttonBar["SWIMMING"]:Formula409() + buttonBar["SWIMMING"]:SetCheckboxTemplate() + buttonBar["SWIMMING"]:SetPanelColor(0.2, 0.42, 0.76, 0.15) + buttonBar["SWIMMING"]:GetCheckedTexture():SetVertexColor(0.2, 0.42, 0.76, 1) + buttonBar["SWIMMING"].key = "SWIMMING" if(enabled) then - button["SWIMMING"]:SetChecked(1) + buttonBar["SWIMMING"]:SetChecked(1) else - button["SWIMMING"]:SetChecked(0) + buttonBar["SWIMMING"]:SetChecked(0) end - button["SWIMMING"]:SetScript("OnClick", CheckButton_OnClick) - button["SWIMMING"]:SetScript("OnEnter", CheckButton_OnEnter) - button["SWIMMING"]:SetScript("OnLeave", CheckButton_OnLeave) + buttonBar["SWIMMING"]:SetScript("OnClick", CheckButton_OnClick) + buttonBar["SWIMMING"]:SetScript("OnEnter", CheckButton_OnEnter) + buttonBar["SWIMMING"]:SetScript("OnLeave", CheckButton_OnLeave) - button["SPECIAL"] = CreateFrame("CheckButton", nil, button, "UICheckButtonTemplate") - button["SPECIAL"]:SetSize(width,height) - button["SPECIAL"]:SetPoint("BOTTOMLEFT", button["SWIMMING"], "BOTTOMRIGHT", 2, 0) - button["SPECIAL"]:Formula409() - button["SPECIAL"]:SetCheckboxTemplate() - button["SPECIAL"]:SetPanelColor(0.7, 0.1, 0.1, 0.15) - button["SPECIAL"]:GetCheckedTexture():SetVertexColor(0.7, 0.1, 0.1, 1) - button["SPECIAL"].key = "SPECIAL" + buttonBar["SPECIAL"] = CreateFrame("CheckButton", nil, buttonBar, "UICheckButtonTemplate") + buttonBar["SPECIAL"]:SetSize(width,height) + buttonBar["SPECIAL"]:SetPoint("BOTTOMLEFT", buttonBar["SWIMMING"], "BOTTOMRIGHT", 2, 0) + buttonBar["SPECIAL"]:Formula409() + buttonBar["SPECIAL"]:SetCheckboxTemplate() + buttonBar["SPECIAL"]:SetPanelColor(0.7, 0.1, 0.1, 0.15) + buttonBar["SPECIAL"]:GetCheckedTexture():SetVertexColor(0.7, 0.1, 0.1, 1) + buttonBar["SPECIAL"].key = "SPECIAL" if(special) then - button["SPECIAL"]:SetChecked(1) + buttonBar["SPECIAL"]:SetChecked(1) else - button["SPECIAL"]:SetChecked(0) + buttonBar["SPECIAL"]:SetChecked(0) end - button["SPECIAL"]:SetScript("OnClick", CheckButton_OnClick) - button["SPECIAL"]:SetScript("OnEnter", CheckButton_OnEnter) - button["SPECIAL"]:SetScript("OnLeave", CheckButton_OnLeave) + buttonBar["SPECIAL"]:SetScript("OnClick", CheckButton_OnClick) + buttonBar["SPECIAL"]:SetScript("OnEnter", CheckButton_OnEnter) + buttonBar["SPECIAL"]:SetScript("OnLeave", CheckButton_OnLeave) + + button.MountBar = barName UpdateMountCheckboxes(button, i) end diff --git a/Interface/AddOns/SVUI/system/classes/Database.lua b/Interface/AddOns/SVUI/system/classes/Database.lua index cac1aff..e3522e9 100644 --- a/Interface/AddOns/SVUI/system/classes/Database.lua +++ b/Interface/AddOns/SVUI/system/classes/Database.lua @@ -166,7 +166,9 @@ do ["special"] = {"VERTICAL", 0.33, 0.25, 0.13, 0.47, 0.39, 0.27}, ["class"] = {"VERTICAL", r2, g2, b2, r1, g1, b1}, ["bizzaro"] = {"VERTICAL", ir2, ig2, ib2, ir1, ig1, ib1}, - ["dark"] = {"VERTICAL", 0.02, 0.02, 0.02, 0.22, 0.22, 0.22}, + ["dark"] = {"VERTICAL", 0.02, 0.02, 0.02, 0.22, 0.22, 0.22}, + ["darkest"] = {"VERTICAL", 0.15, 0.15, 0.15, 0, 0, 0}, + ["darkest2"] = {"VERTICAL", 0, 0, 0, 0.12, 0.12, 0.12}, ["light"] = {"VERTICAL", 0.65, 0.65, 0.65, 0.95, 0.95, 0.95}, ["highlight"] = {"VERTICAL", 0.1, 0.8, 0.8, 0.2, 0.5, 1}, ["green"] = {"VERTICAL", 0.08, 0.5, 0, 0.25, 0.9, 0.08}, @@ -763,7 +765,8 @@ local DatabaseDefaults = { ["enable"] = true, ["font"] = "SVUI Number Font", ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", + ["fontOutline"] = "OUTLINE", + ["showBackground"] = true, ["panels"] = { ["BottomRightDataPanel"] = { ["right"] = "Bags", diff --git a/Interface/AddOns/SVUI/system/templates.lua b/Interface/AddOns/SVUI/system/templates.lua index 6469c3f..8197bd8 100644 --- a/Interface/AddOns/SVUI/system/templates.lua +++ b/Interface/AddOns/SVUI/system/templates.lua @@ -166,7 +166,7 @@ local function SetFontTemplate(self, font, fontSize, fontStyle, fontJustifyH, fo self.fontJustifyH = fontJustifyH; self.fontJustifyV = fontJustifyV; self:SetFont(font, fontSize, fontStyle) - if(fontStyle and fontStyle ~= "NONE") then + if(fontStyle and fontStyle ~= "NONE") then self:SetShadowColor(0, 0, 0, 0) else self:SetShadowColor(0, 0, 0, 0.2) @@ -300,7 +300,7 @@ local _templates = { shadow = true, noupdate = false, }, - ["FramedButton"] = { + ["FramedTop"] = { backdrop = { bgFile = [[Interface\BUTTONS\WHITE8X8]], edgeFile = [[Interface\BUTTONS\WHITE8X8]], @@ -309,14 +309,37 @@ local _templates = { edgeSize = 1, insets = { - left = 1, - right = 1, - top = 1, - bottom = 1, + left = 0, + right = 0, + top = 0, + bottom = 0, }, }, color = "default", - gradient = "inverse", + gradient = "darkest2", + texture = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT2]], + texupdate = true, + padding = 1, + shadow = false, + noupdate = false, + }, + ["FramedBottom"] = { + backdrop = { + bgFile = [[Interface\BUTTONS\WHITE8X8]], + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = + { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + }, + color = "default", + gradient = "darkest", texture = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], texupdate = true, padding = 1, @@ -1031,10 +1054,10 @@ local function SetEditboxTemplate(self, x, y) self.styled = true end; -local function SetFramedButtonTemplate(self) +local function SetFramedButtonTemplate(self, template) if self.styled then return end; - - CreatePanelTemplate(self, "FramedButton", false, false, 1) + template = template or "FramedBottom" + CreatePanelTemplate(self, template, false, false, 1) if(self.Left) then self.Left:SetAlpha(0) diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua index fc58334..2e0d949 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua @@ -58,23 +58,12 @@ SuperVillain.Options.args.SVStats = { }, localtime = {order = 3, type = "toggle", name = L["Local Time"], desc = L["If not set to true then the server time will be displayed instead."]}, battleground = {order = 4, type = "toggle", name = L["Battleground Texts"], desc = L["When inside a battleground display personal scoreboard information on the main datatext bars."]}, - topLeftDockPanel = { - order = 6, - name = "Top Left Dock", - desc = L["Display statistics along the top of the screen"], - type = "toggle" - }, - bottomLeftDockPanel = { - order = 7, - name = "Bottom Left", - desc = L["Display statistics along the bottom of the screen"], - type = "toggle" - }, - bottomRightDockPanel = { - order = 8, - name = "Bottom Right", - desc = L["Display statistics along the bottom of the screen"], - type = "toggle" + showBackground = { + order = 5, + name = "Show Backgrounds", + desc = L["Display statistic background textures"], + type = "toggle", + set = function(i, h)MOD:ChangeDBVar(h, i[#i]);SuperVillain:StaticPopup_Show("RL_CLIENT")end, }, panels = { type = "group", diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/petjournal.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/petjournal.lua index 919155c..8e0a297 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/petjournal.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/petjournal.lua @@ -20,6 +20,62 @@ local STYLE = _G.StyleVillain; HELPERS ########################################################## ]]-- +local function Button_OnEnter(this) + this:SetBackdropColor(unpack(SuperVillain.Media.color.highlight)) +end + +local function Button_OnLeave(this) + this:SetBackdropColor(unpack(SuperVillain.Media.color.default)) +end + +local function StyleListButton(this, adjust, shrink) + if(not this or (this and this.appliedStyle)) then return end + + local link = this:GetName() + local barName = this.MountBar + local bar = _G[barName] + + this:SetPanelTemplate("Button", true, 1, -2, -2) + + if link then + if _G[link.."Name"] then + _G[link.."Name"]:SetParent(this.Panel) + end + local icon = this.icon or this.IconTexture; + if _G[link.."IconTexture"] then + icon = _G[link.."IconTexture"] + elseif _G[link.."Icon"]then + icon = _G[link.."Icon"] + end + if icon then + icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + local bg = CreateFrame("Frame", nil, this) + bg:WrapOuter(icon) + bg:SetFixedPanelTemplate("Transparent") + icon:SetParent(bg) + this.IconShadow = bg + end + if(_G[link.."Count"]) then + local fg = CreateFrame("Frame", nil, this) + fg:SetSize(120, 22) + fg:SetPoint("BOTTOMLEFT", this, "BOTTOMLEFT", 0, -11) + fg:SetFrameLevel(this:GetFrameLevel() + 30) + _G[link.."Count"]:SetParent(fg) + _G[link.."Count"]:SetAllPoints(fg) + _G[link.."Count"]:SetFont(SuperVillain.Media.font.numbers, 12, "OUTLINE") + _G[link.."Count"]:SetDrawLayer("ARTWORK",7) + end + + if bar then + bar:SetParent(this.Panel) + end + end + this:HookScript("OnEnter", Button_OnEnter) + this:HookScript("OnLeave", Button_OnLeave) + + this.appliedStyle = true +end + local function PetJournal_UpdateMounts() for b = 1, #MountJournal.ListScrollFrame.buttons do local d = _G["MountJournalListScrollFrameButton"..b] @@ -28,7 +84,7 @@ local function PetJournal_UpdateMounts() e:SetTextColor(1, 1, 0) if d.Panel then d:SetBackdropBorderColor(1, 1, 0) - end; + end if d.IconShadow then d.IconShadow:SetBackdropBorderColor(1, 1, 0) end @@ -36,13 +92,13 @@ local function PetJournal_UpdateMounts() e:SetTextColor(1, 1, 1) if d.Panel then d:SetBackdropBorderColor(0,0,0,1) - end; + end if d.IconShadow then d.IconShadow:SetBackdropBorderColor(0,0,0,1) end end end -end; +end local function PetJournal_UpdatePets() local u = PetJournal.listScroll.buttons; @@ -51,7 +107,7 @@ local function PetJournal_UpdatePets() local v = u[b].index; if not v then break - end; + end local d = _G["PetJournalListScrollFrameButton"..b] local e = _G["PetJournalListScrollFrameButton"..b.."Name"] local w, x, y, z, level, favorite, A, B, C, D, E, F, G, H, I = C_PetJournal.GetPetInfoByIndex(v, isWild) @@ -61,33 +117,33 @@ local function PetJournal_UpdatePets() e:SetTextColor(1, 1, 0) else e:SetTextColor(1, 1, 1) - end; + end if N then local color = ITEM_QUALITY_COLORS[N-1] if d.Panel then d.Panel:SetBackdropBorderColor(color.r, color.g, color.b) - end; + end if d.IconShadow then d.IconShadow:SetBackdropBorderColor(color.r, color.g, color.b) end else if d.Panel then d.Panel:SetBackdropBorderColor(1, 1, 0, 0.5) - end; + end if d.IconShadow then d.IconShadow:SetBackdropBorderColor(1, 1, 0, 0.5) end end end end -end; +end --[[ ########################################################## FRAME STYLER ########################################################## ]]-- local function PetJournalStyle() - if SuperVillain.db.SVStyle.blizzard.enable ~= true or SuperVillain.db.SVStyle.blizzard.mounts ~= true then return end; + if SuperVillain.db.SVStyle.blizzard.enable ~= true or SuperVillain.db.SVStyle.blizzard.mounts ~= true then return end PetJournalParent:Formula409() PetJournalParent:SetPanelTemplate("Halftone") PetJournalParentPortrait:Hide() @@ -105,10 +161,13 @@ local function PetJournalStyle() MountJournalSearchBox:SetEditboxTemplate() STYLE:ApplyScrollStyle(MountJournalListScrollFrameScrollBar) MountJournal.MountDisplay:SetFixedPanelTemplate("Comic") - for b = 1, #MountJournal.ListScrollFrame.buttons do - STYLE:ApplyLinkButtonStyle(_G["MountJournalListScrollFrameButton"..b], false, true) - end; + for i = 1, #MountJournal.ListScrollFrame.buttons do + local button = _G["MountJournalListScrollFrameButton"..i] + if(button) then + StyleListButton(button) + end + end hooksecurefunc("MountJournal_UpdateMountList", PetJournal_UpdateMounts) MountJournalListScrollFrame:HookScript("OnVerticalScroll", PetJournal_UpdateMounts) MountJournalListScrollFrame:HookScript("OnMouseWheel", PetJournal_UpdateMounts) @@ -119,9 +178,10 @@ local function PetJournalStyle() PetJournalRightInset:Formula409() PetJournalLeftInset:Formula409() - for b = 1, 3 do - local s = _G["PetJournalLoadoutPet"..b.."HelpFrame"]s:Formula409() - end; + for i = 1, 3 do + local button = _G["PetJournalLoadoutPet" .. i .. "HelpFrame"] + button:Formula409() + end PetJournalTutorialButton:MUNG() PetJournal.PetCount:Formula409() @@ -131,21 +191,23 @@ local function PetJournalStyle() PetJournalListScrollFrame:Formula409() STYLE:ApplyScrollStyle(PetJournalListScrollFrameScrollBar) - for b = 1, #PetJournal.listScroll.buttons do - local d = _G["PetJournalListScrollFrameButton"..b] - local f = _G["PetJournalListScrollFrameButton"..b.."Favorite"] - STYLE:ApplyLinkButtonStyle(d, false, true) - if(f) then - local fg = CreateFrame("Frame", nil, d) + for i = 1, #PetJournal.listScroll.buttons do + local button = _G["PetJournalListScrollFrameButton" .. i] + local favorite = _G["PetJournalListScrollFrameButton" .. i .. "Favorite"] + STYLE:ApplyLinkButtonStyle(button, false, true) + if(favorite) then + local fg = CreateFrame("Frame", nil, button) fg:SetSize(40,40) - fg:SetPoint("TOPLEFT", d, "TOPLEFT", -1, 1) - fg:SetFrameLevel(d:GetFrameLevel() + 30) - f:SetParent(fg) - d.dragButton.favorite:SetParent(fg) + fg:SetPoint("TOPLEFT", button, "TOPLEFT", -1, 1) + fg:SetFrameLevel(button:GetFrameLevel() + 30) + favorite:SetParent(fg) + button.dragButton.favorite:SetParent(fg) end - d.dragButton.levelBG:SetAlpha(0) - d.dragButton.level:SetParent(d) - end; + + button.dragButton.levelBG:SetAlpha(0) + button.dragButton.level:SetParent(button) + button.petTypeIcon:SetParent(button.Panel) + end hooksecurefunc('PetJournal_UpdatePetList', PetJournal_UpdatePets) PetJournalListScrollFrame:HookScript("OnVerticalScroll", PetJournal_UpdatePets) @@ -187,7 +249,7 @@ local function PetJournalStyle() s.Panel:SetFrameLevel(s:GetFrameLevel() + 1) _G['PetJournalLoadoutPet'..b..'Spell'..v..'Icon']:SetParent(s.Panel) end - end; + end PetJournalSpellSelect:Formula409() @@ -196,7 +258,7 @@ local function PetJournalStyle() STYLE:ApplyLinkButtonStyle(Q) _G['PetJournalSpellSelectSpell'..b..'Icon']:FillInner(Q) _G['PetJournalSpellSelectSpell'..b..'Icon']:SetDrawLayer('BORDER') - end; + end PetJournalPetCard:Formula409() PetJournalPetCard:SetPanelTemplate("Inset") @@ -222,7 +284,7 @@ local function PetJournalStyle() if R.Delimiter1 then R.Delimiter1:SetTexture(nil) R.Delimiter2:SetTexture(nil) - end; + end R.BorderTop:SetTexture(nil) R.BorderTopLeft:SetTexture(nil) R.BorderTopRight:SetTexture(nil) @@ -240,14 +302,14 @@ local function PetJournalStyle() S.Panel:SetAllPoints() S.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) S.icon:FillInner(S.Panel) - end; + end PetJournalPetCardHealthFrame.healthBar:Formula409() PetJournalPetCardHealthFrame.healthBar:SetPanelTemplate('Default') PetJournalPetCardHealthFrame.healthBar:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) PetJournalPetCardXPBar:Formula409() PetJournalPetCardXPBar:SetPanelTemplate('Default') PetJournalPetCardXPBar:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) -end; +end --[[ ########################################################## STYLE LOADING diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua index ce4a778..71da56a 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua @@ -482,46 +482,6 @@ local function forceBackdropColor(self, r, g, b, a) GhostFrame:SetBackdropBorderColor(0,0,0,0) end end - -local originalNavBar_AddButton = _G.NavBar_AddButton - -local function newNavBar_AddButton(self, buttonData) - local navButton = self.freeButtons[#self.freeButtons]; - if navButton then - self.freeButtons[#self.freeButtons] = nil; - end - - if not navButton then - navButton = CreateFrame("BUTTON", self:GetName().."Button"..(#self.navList+1), self, self.template); - navButton.oldClick = navButton:GetScript("OnClick"); - navButton:SetScript("OnClick", NavBar_ButtonOnClick); - navButton:RegisterForClicks("LeftButtonUp", "RightButtonUp"); - - if not navButton:GetScript("OnEnter") then - navButton:SetScript("OnEnter", NavBar_ButtonOnEnter); - end - - if not navButton:GetScript("OnLeave") then - navButton:SetScript("OnLeave", NavBar_ButtonOnLeave); - end - end - - - --Set up the button - local navParent = self.navList[#self.navList]; - self.navList[#self.navList+1] = navButton; - - navButton:SetText(buttonData.name); - navButton:SetWidth(navButton.text:GetStringWidth()+30); - - navButton.myclick = buttonData.OnClick; - navButton.listFunc = buttonData.listFunc; - navButton.id = buttonData.id; - navButton.data = buttonData; - navButton:SetButtonTemplate(); - navButton:Show(); - NavBar_CheckLength(self); -end --[[ ########################################################## SYSTEM WIDGET STYLERS @@ -1029,7 +989,6 @@ local function SystemPanelQue() SideDressUpFrame.BGTopLeft:Hide() SideDressUpFrame.BGBottomLeft:Hide() SideDressUpModelResetButton:SetButtonTemplate() - _G.NavBar_AddButton = newNavBar_AddButton end --[[ ########################################################## diff --git a/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua b/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua index 69f5831..760708a 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua @@ -81,7 +81,7 @@ end local function DD_OnLeave(btn) btn.hoverTex:Hide() -end; +end local function CloseButton_OnEnter(this) this:SetBackdropBorderColor(unpack(SuperVillain.Media.color.highlight)) @@ -96,60 +96,60 @@ CORE FUNCTIONS ########################################################## ]]-- function STYLE:ApplyCloseButtonStyle(this, anchor) - if not this then return end; + if not this then return end if not this.hookedColors then this:HookScript("OnEnter", CloseButton_OnEnter) this:HookScript("OnLeave", CloseButton_OnLeave) this.hookedColors = true - end; + end if anchor then this:SetPoint("TOPRIGHT", anchor, "TOPRIGHT", 2, 2) end -end; +end function STYLE:ApplyScrollStyle(this) - if(not this or (this and this.appliedStyle)) then return end; + if(not this or (this and this.appliedStyle)) then return end if _G[this:GetName().."BG"]then _G[this:GetName().."BG"]:SetTexture(nil) - end; + end if _G[this:GetName().."Track"]then _G[this:GetName().."Track"]:SetTexture(nil) - end; + end if _G[this:GetName().."Top"]then _G[this:GetName().."Top"]:SetTexture(nil) - end; + end if _G[this:GetName().."Bottom"]then _G[this:GetName().."Bottom"]:SetTexture(nil) - end; + end if _G[this:GetName().."Middle"]then _G[this:GetName().."Middle"]:SetTexture(nil) - end; + end if _G[this:GetName().."ScrollUpButton"] and _G[this:GetName().."ScrollDownButton"]then _G[this:GetName().."ScrollUpButton"]:Formula409() if not _G[this:GetName().."ScrollUpButton"].icon then STYLE:ApplyPaginationStyle(_G[this:GetName().."ScrollUpButton"]) SquareButton_SetIcon(_G[this:GetName().."ScrollUpButton"], "UP") _G[this:GetName().."ScrollUpButton"]:Size(_G[this:GetName().."ScrollUpButton"]:GetWidth() + 7, _G[this:GetName().."ScrollUpButton"]:GetHeight() + 7) - end; + end _G[this:GetName().."ScrollDownButton"]:Formula409() if not _G[this:GetName().."ScrollDownButton"].icon then STYLE:ApplyPaginationStyle(_G[this:GetName().."ScrollDownButton"]) SquareButton_SetIcon(_G[this:GetName().."ScrollDownButton"], "DOWN") _G[this:GetName().."ScrollDownButton"]:Size(_G[this:GetName().."ScrollDownButton"]:GetWidth() + 7, _G[this:GetName().."ScrollDownButton"]:GetHeight() + 7) - end; + end if not this.styledBackground then this.styledBackground = CreateFrame("Frame", nil, this) this.styledBackground:Point("TOPLEFT", _G[this:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1) this.styledBackground:Point("BOTTOMRIGHT", _G[this:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1) this.styledBackground:SetPanelTemplate("Inset", true) - end; + end this:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") end this.appliedStyle = true -end; +end function STYLE:ApplyScrollbarStyle(this) - if(not this or (this and this.appliedStyle)) then return end; + if(not this or (this and this.appliedStyle)) then return end this:Formula409() this:SetFixedPanelTemplate("Inset") hooksecurefunc(this, "SetBackdrop", function(f, backdrop) @@ -173,10 +173,10 @@ function STYLE:ApplyScrollbarStyle(this) end end this.appliedStyle = true -end; +end function STYLE:ApplyTabStyle(this) - if(not this or (this and this.appliedStyle)) then return end; + if(not this or (this and this.appliedStyle)) then return end local tab = this:GetName(); if _G[tab.."Left"] then _G[tab.."Left"]:SetTexture(nil) end @@ -190,7 +190,7 @@ function STYLE:ApplyTabStyle(this) this:GetHighlightTexture():SetTexture(nil) else this:Formula409() - end; + end local text = _G[tab.."Text"] this.backdrop = CreateFrame("Frame", nil, this) @@ -203,10 +203,10 @@ function STYLE:ApplyTabStyle(this) this:HookScript("OnEnter",Tab_OnEnter) this:HookScript("OnLeave",Tab_OnLeave) this.appliedStyle = true -end; +end function STYLE:ApplyPaginationStyle(button, isVertical) - if(not button or not button:GetName() or (button and button.appliedStyle)) then return end; + if(not button or not button:GetName() or (button and button.appliedStyle)) then return end local c,d,e; local leftDown = (button:GetName() and find(button:GetName():lower(),'left')) or find(button:GetName():lower(),'prev') or find(button:GetName():lower(),'decrement') button:Formula409() @@ -239,22 +239,22 @@ function STYLE:ApplyPaginationStyle(button, isVertical) if not button:IsEnabled()then button:GetScript('OnDisable')(button) end - end; + end if isVertical then if leftDown then SquareButton_SetIcon(button,'UP')else SquareButton_SetIcon(button,'DOWN')end else if leftDown then SquareButton_SetIcon(button,'LEFT')else SquareButton_SetIcon(button,'RIGHT')end - end; + end button:SetButtonTemplate() button:Size((button:GetWidth() - 7),(button:GetHeight() - 7)) button.appliedStyle = true -end; +end function STYLE:ApplyDropdownStyle(this, width) - if(not this or (this and this.appliedStyle)) then return end; + if(not this or (this and this.appliedStyle)) then return end local ddname = this:GetName(); local button = _G[this:GetName().."Button"] - if not width then width = 155 end; + if not width then width = 155 end this:Formula409() this:Width(width) _G[ddname.."Text"]:ClearAllPoints() @@ -273,10 +273,10 @@ function STYLE:ApplyDropdownStyle(this, width) bg:Point("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) bg:SetPanelTemplate("Inset") this.appliedStyle = true -end; +end function STYLE:ApplyLinkButtonStyle(this, adjust, shrink) - if(not this or (this and this.appliedStyle)) then return end; + if(not this or (this and this.appliedStyle)) then return end local link = this:GetName() this:Formula409() @@ -285,22 +285,22 @@ function STYLE:ApplyLinkButtonStyle(this, adjust, shrink) this:SetPanelTemplate("Button", true, 1, -2, -2) else this:SetFixedPanelTemplate("Button") - end; + end if link then if _G[link.."Name"] then _G[link.."Name"]:SetParent(this.Panel) - end; + end local icon = this.icon or this.IconTexture; if _G[link.."IconTexture"] then icon = _G[link.."IconTexture"] elseif _G[link.."Icon"]then icon = _G[link.."Icon"] - end; + end if icon then icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) if adjust then icon:FillInner(this, 2, 2) - end; + end local bg = CreateFrame("Frame", nil, this) bg:WrapOuter(icon) bg:SetFixedPanelTemplate("Transparent") @@ -316,15 +316,15 @@ function STYLE:ApplyLinkButtonStyle(this, adjust, shrink) _G[link.."Count"]:SetAllPoints(fg) _G[link.."Count"]:SetFontTemplate(SuperVillain.Media.font.numbers, 12, "OUTLINE", "LEFT") _G[link.."Count"]:SetDrawLayer("ARTWORK",7) - end; - end; + end + end this:HookScript("OnEnter",Button_OnEnter) this:HookScript("OnLeave",Button_OnLeave) this.appliedStyle = true -end; +end function STYLE:ApplyTooltipStyle(frame) - if(not frame or (frame and frame.appliedStyle)) then return end; + if(not frame or (frame and frame.appliedStyle)) then return end frame:HookScript('OnShow',function(this) this:SetBackdrop({ bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], @@ -336,18 +336,18 @@ function STYLE:ApplyTooltipStyle(frame) this:SetBackdropBorderColor(0,0,0) end) frame.appliedStyle = true -end; +end function STYLE:ApplyFrameStyle(frame,template,noStripping,fullStripping) - if(not frame or (frame and frame.appliedStyle)) then return end; - if not template then template = 'Transparent' end; - if not noStripping then frame:Formula409(fullStripping) end; + if(not frame or (frame and frame.appliedStyle)) then return end + if not template then template = 'Transparent' end + if not noStripping then frame:Formula409(fullStripping) end frame:SetPanelTemplate(template) frame.appliedStyle = true -end; +end function STYLE:ApplyAlertStyle(frame) - if(not frame or (frame and frame.appliedStyle)) then return end; + if(not frame or (frame and frame.appliedStyle)) then return end local alertpanel = CreateFrame("Frame", nil, frame) alertpanel:SetAllPoints(frame) alertpanel:SetFrameLevel(frame:GetFrameLevel() - 1) @@ -382,4 +382,4 @@ function STYLE:ApplyAlertStyle(frame) bottom:Width(frame:GetHeight() * 0.5) frame.appliedStyle = true -end; \ No newline at end of file +end \ No newline at end of file