mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
update tables
This commit is contained in:
+199
-185
@@ -1,14 +1,15 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local LSM = LibStub("LibSharedMedia-3.0");
|
||||
local LBF = LibStub("LibButtonFacade", true);
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tonumber, pairs, ipairs, error, unpack, select, tostring = tonumber, pairs, ipairs, error, unpack, select, tostring
|
||||
local assert, print, type, collectgarbage, pcall, date = assert, print, type, collectgarbage, pcall, date
|
||||
local assert, type, collectgarbage, pcall ,print, date = assert, type, collectgarbage, pcall, print, date
|
||||
local getn, twipe, tinsert, tremove, next = table.getn, table.wipe, tinsert, tremove, next
|
||||
local floor = floor
|
||||
local format, find, match, strrep, len, sub, gsub = string.format, string.find, string.match, strrep, string.len, string.sub, string.gsub
|
||||
local format, find, match, strrep, len, sub, gsub, strjoin = string.format, string.find, string.match, strrep, string.len, string.sub, string.gsub, strjoin
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetCVar = GetCVar
|
||||
@@ -37,21 +38,22 @@ E.resolution = GetCVar("gxResolution")
|
||||
E.screenheight = tonumber(match(E.resolution, "%d+x(%d+)"))
|
||||
E.screenwidth = tonumber(match(E.resolution, "(%d+)x+%d"))
|
||||
E.isMacClient = IsMacClient()
|
||||
E.PixelMode = false
|
||||
|
||||
E["media"] = {}
|
||||
E["frames"] = {}
|
||||
E["unitFrameElements"] = {}
|
||||
E["statusBars"] = {}
|
||||
E["texts"] = {}
|
||||
E["snapBars"] = {}
|
||||
E["RegisteredModules"] = {}
|
||||
E["RegisteredInitialModules"] = {}
|
||||
E["ModuleCallbacks"] = {["CallPriority"] = {}}
|
||||
E["InitialModuleCallbacks"] = {["CallPriority"] = {}}
|
||||
E["valueColorUpdateFuncs"] = {}
|
||||
--Tables
|
||||
E.media = {}
|
||||
E.frames = {}
|
||||
E.unitFrameElements = {}
|
||||
E.statusBars = {}
|
||||
E.texts = {}
|
||||
E.snapBars = {}
|
||||
E.RegisteredModules = {}
|
||||
E.RegisteredInitialModules = {}
|
||||
E.ModuleCallbacks = {["CallPriority"] = {}}
|
||||
E.InitialModuleCallbacks = {["CallPriority"] = {}}
|
||||
E.valueColorUpdateFuncs = {}
|
||||
E.TexCoords = {.08, .92, .08, .92}
|
||||
E.CreditsList = {}
|
||||
E.PixelMode = false
|
||||
|
||||
E.InversePoints = {
|
||||
TOP = "BOTTOM",
|
||||
@@ -73,7 +75,7 @@ E.DispelClasses = {
|
||||
["SHAMAN"] = {
|
||||
["Poison"] = true,
|
||||
["Disease"] = true,
|
||||
["Curse"] = false
|
||||
["Curse"] = true
|
||||
},
|
||||
["PALADIN"] = {
|
||||
["Poison"] = true,
|
||||
@@ -144,6 +146,7 @@ function E:Print(msg)
|
||||
(_G[self.db.general.messageRedirect] or DEFAULT_CHAT_FRAME):AddMessage(strjoin("", self:ColorizedName("ElvUI", true), msg)) -- I put DEFAULT_CHAT_FRAME as a fail safe.
|
||||
end
|
||||
|
||||
--Workaround for people wanting to use white and it reverting to their class color.
|
||||
E.PriestColors = {
|
||||
r = 0.99,
|
||||
g = 0.99,
|
||||
@@ -167,10 +170,11 @@ function E:ShapeshiftDelayedUpdate(func, ...)
|
||||
end, 0.05)
|
||||
end
|
||||
|
||||
--Basically check if another class border is being used on a class that doesn't match. And then return true if a match is found.
|
||||
function E:CheckClassColor(r, g, b)
|
||||
r, g, b = floor(r*100 + .5) / 100, floor(g*100 + .5) / 100, floor(b*100 + .5) / 100
|
||||
local matchFound = false
|
||||
for class, _ in pairs(RAID_CLASS_COLORS) do
|
||||
for class in pairs(RAID_CLASS_COLORS) do
|
||||
if class ~= E.myclass then
|
||||
local colorTable = class == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class])
|
||||
if colorTable.r == r and colorTable.g == g and colorTable.b == b then
|
||||
@@ -195,55 +199,56 @@ function E:GetColorTable(data)
|
||||
end
|
||||
|
||||
function E:UpdateMedia()
|
||||
if not (self.db and self.db["general"] and self.private["general"]) then return end
|
||||
if not self.db.general or not self.private.general then return end --Prevent rare nil value errors
|
||||
|
||||
-- Fonts
|
||||
self["media"].normFont = LSM:Fetch("font", self.db["general"].font)
|
||||
self["media"].combatFont = LSM:Fetch("font", self.db["general"].dmgfont)
|
||||
self.media.normFont = LSM:Fetch("font", self.db.general.font)
|
||||
self.media.combatFont = LSM:Fetch("font", self.private.general.dmgfont)
|
||||
|
||||
-- Textures
|
||||
self["media"].blankTex = LSM:Fetch("background", "ElvUI Blank")
|
||||
self["media"].normTex = LSM:Fetch("statusbar", self.private["general"].normTex)
|
||||
self["media"].glossTex = LSM:Fetch("statusbar", self.private["general"].glossTex)
|
||||
self.media.blankTex = LSM:Fetch("background", "ElvUI Blank")
|
||||
self.media.normTex = LSM:Fetch("statusbar", self.private.general.normTex)
|
||||
self.media.glossTex = LSM:Fetch("statusbar", self.private.general.glossTex)
|
||||
|
||||
-- Border Color
|
||||
local border = E.db["general"].bordercolor
|
||||
local border = E.db.general.bordercolor
|
||||
if self:CheckClassColor(border.r, border.g, border.b) then
|
||||
local classColor = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
|
||||
E.db["general"].bordercolor.r = classColor.r
|
||||
E.db["general"].bordercolor.g = classColor.g
|
||||
E.db["general"].bordercolor.b = classColor.b
|
||||
E.db.general.bordercolor.r = classColor.r
|
||||
E.db.general.bordercolor.g = classColor.g
|
||||
E.db.general.bordercolor.b = classColor.b
|
||||
end
|
||||
|
||||
self["media"].bordercolor = {border.r, border.g, border.b}
|
||||
self.media.bordercolor = {border.r, border.g, border.b}
|
||||
|
||||
-- UnitFrame Border Color
|
||||
border = E.db["unitframe"].colors.borderColor
|
||||
border = E.db.unitframe.colors.borderColor
|
||||
if self:CheckClassColor(border.r, border.g, border.b) then
|
||||
local classColor = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
|
||||
E.db["unitframe"].colors.borderColor.r = classColor.r
|
||||
E.db["unitframe"].colors.borderColor.g = classColor.g
|
||||
E.db["unitframe"].colors.borderColor.b = classColor.b
|
||||
E.db.unitframe.colors.borderColor.r = classColor.r
|
||||
E.db.unitframe.colors.borderColor.g = classColor.g
|
||||
E.db.unitframe.colors.borderColor.b = classColor.b
|
||||
end
|
||||
self["media"].unitframeBorderColor = {border.r, border.g, border.b}
|
||||
self.media.unitframeBorderColor = {border.r, border.g, border.b}
|
||||
|
||||
-- Backdrop Color
|
||||
self["media"].backdropcolor = E:GetColorTable(self.db["general"].backdropcolor)
|
||||
self.media.backdropcolor = E:GetColorTable(self.db.general.backdropcolor)
|
||||
|
||||
-- Backdrop Fade Color
|
||||
self["media"].backdropfadecolor = E:GetColorTable(self.db["general"].backdropfadecolor)
|
||||
self.media.backdropfadecolor = E:GetColorTable(self.db.general.backdropfadecolor)
|
||||
|
||||
-- Value Color
|
||||
local value = self.db["general"].valuecolor
|
||||
local value = self.db.general.valuecolor
|
||||
|
||||
if self:CheckClassColor(value.r, value.g, value.b) then
|
||||
value = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
|
||||
self.db["general"].valuecolor.r = value.r
|
||||
self.db["general"].valuecolor.g = value.g
|
||||
self.db["general"].valuecolor.b = value.b
|
||||
self.db.general.valuecolor.r = value.r
|
||||
self.db.general.valuecolor.g = value.g
|
||||
self.db.general.valuecolor.b = value.b
|
||||
end
|
||||
|
||||
self["media"].hexvaluecolor = self:RGBToHex(value.r, value.g, value.b)
|
||||
self["media"].rgbvaluecolor = {value.r, value.g, value.b}
|
||||
self.media.hexvaluecolor = self:RGBToHex(value.r, value.g, value.b)
|
||||
self.media.rgbvaluecolor = {value.r, value.g, value.b}
|
||||
|
||||
if LeftChatPanel and LeftChatPanel.tex and RightChatPanel and RightChatPanel.tex then
|
||||
LeftChatPanel.tex:SetTexture(E.db.chat.panelBackdropNameLeft)
|
||||
@@ -258,13 +263,14 @@ function E:UpdateMedia()
|
||||
self:UpdateBlizzardFonts()
|
||||
end
|
||||
|
||||
--Update font/texture paths when they are registered by the addon providing them
|
||||
--This helps fix most of the issues with fonts or textures reverting to default because the addon providing them is loading after ElvUI.
|
||||
--We use a wrapper to avoid errors in :UpdateMedia because "self" is passed to the function with a value other than ElvUI.
|
||||
local function LSMCallback()
|
||||
E:UpdateMedia()
|
||||
end
|
||||
LSM.RegisterCallback(E, "LibSharedMedia_Registered", LSMCallback)
|
||||
|
||||
local LBF = LibStub("LibButtonFacade", true)
|
||||
|
||||
local LBFGroupToTableElement = {
|
||||
["ActionBars"] = "actionbar",
|
||||
["Auras"] = "auras"
|
||||
@@ -308,91 +314,95 @@ function E:PLAYER_ENTERING_WORLD()
|
||||
end
|
||||
|
||||
function E:ValueFuncCall()
|
||||
for func, _ in pairs(self["valueColorUpdateFuncs"]) do
|
||||
func(self["media"].hexvaluecolor, unpack(self["media"].rgbvaluecolor))
|
||||
for func in pairs(self.valueColorUpdateFuncs) do
|
||||
func(self.media.hexvaluecolor, unpack(self.media.rgbvaluecolor))
|
||||
end
|
||||
end
|
||||
|
||||
function E:UpdateFrameTemplates()
|
||||
for frame in pairs(self["frames"]) do
|
||||
if frame and frame.template then
|
||||
E:SetTemplate(frame, frame.template, frame.glossTex)
|
||||
for frame in pairs(self.frames) do
|
||||
if frame and frame.template and not frame.ignoreUpdates then
|
||||
if not frame.ignoreFrameTemplates then
|
||||
E:SetTemplate(frame, frame.template, frame.glossTex)
|
||||
end
|
||||
else
|
||||
self["frames"][frame] = nil
|
||||
self.frames[frame] = nil
|
||||
end
|
||||
end
|
||||
|
||||
for frame in pairs(self["unitFrameElements"]) do
|
||||
for frame in pairs(self.unitFrameElements) do
|
||||
if frame and frame.template and not frame.ignoreUpdates then
|
||||
E:SetTemplate(frame, frame.template, frame.glossTex)
|
||||
if not frame.ignoreFrameTemplates then
|
||||
E:SetTemplate(frame, frame.template, frame.glossTex)
|
||||
end
|
||||
else
|
||||
self["unitFrameElements"][frame] = nil
|
||||
self.unitFrameElements[frame] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function E:UpdateBorderColors()
|
||||
for frame, _ in pairs(self["frames"]) do
|
||||
for frame in pairs(self.frames) do
|
||||
if frame and not frame.ignoreUpdates then
|
||||
if not frame.ignoreBorderColors then
|
||||
if frame.template == "Default" or frame.template == "Transparent" or frame.template == nil then
|
||||
frame:SetBackdropBorderColor(unpack(self["media"].bordercolor))
|
||||
frame:SetBackdropBorderColor(unpack(self.media.bordercolor))
|
||||
end
|
||||
end
|
||||
else
|
||||
self["frames"][frame] = nil
|
||||
self.frames[frame] = nil
|
||||
end
|
||||
end
|
||||
|
||||
for frame, _ in pairs(self["unitFrameElements"]) do
|
||||
for frame in pairs(self.unitFrameElements) do
|
||||
if frame and not frame.ignoreUpdates then
|
||||
if not frame.ignoreBorderColors then
|
||||
if frame.template == "Default" or frame.template == "Transparent" or frame.template == nil then
|
||||
frame:SetBackdropBorderColor(unpack(self["media"].unitframeBorderColor))
|
||||
frame:SetBackdropBorderColor(unpack(self.media.unitframeBorderColor))
|
||||
end
|
||||
end
|
||||
else
|
||||
self["unitFrameElements"][frame] = nil
|
||||
self.unitFrameElements[frame] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function E:UpdateBackdropColors()
|
||||
for frame, _ in pairs(self["frames"]) do
|
||||
for frame in pairs(self.frames) do
|
||||
if frame then
|
||||
if not frame.ignoreBackdropColors then
|
||||
if frame.template == "Default" or frame.template == nil then
|
||||
frame:SetBackdropColor(unpack(self["media"].backdropcolor))
|
||||
frame:SetBackdropColor(unpack(self.media.backdropcolor))
|
||||
elseif frame.template == "Transparent" then
|
||||
frame:SetBackdropColor(unpack(self["media"].backdropfadecolor))
|
||||
frame:SetBackdropColor(unpack(self.media.backdropfadecolor))
|
||||
end
|
||||
end
|
||||
else
|
||||
self["frames"][frame] = nil
|
||||
self.frames[frame] = nil
|
||||
end
|
||||
end
|
||||
|
||||
for frame, _ in pairs(self["unitFrameElements"]) do
|
||||
for frame in pairs(self.unitFrameElements) do
|
||||
if frame then
|
||||
if not frame.ignoreBackdropColors then
|
||||
if frame.template == "Default" or frame.template == nil then
|
||||
frame:SetBackdropColor(unpack(self["media"].backdropcolor))
|
||||
frame:SetBackdropColor(unpack(self.media.backdropcolor))
|
||||
elseif frame.template == "Transparent" then
|
||||
frame:SetBackdropColor(unpack(self["media"].backdropfadecolor))
|
||||
frame:SetBackdropColor(unpack(self.media.backdropfadecolor))
|
||||
end
|
||||
end
|
||||
else
|
||||
self["unitFrameElements"][frame] = nil
|
||||
self.unitFrameElements[frame] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function E:UpdateFontTemplates()
|
||||
for text, _ in pairs(self["texts"]) do
|
||||
for text in pairs(self.texts) do
|
||||
if text then
|
||||
E:FontTemplate(text, text.font, text.fontSize, text.fontStyle)
|
||||
else
|
||||
self["texts"][text] = nil
|
||||
self.texts[text] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -417,7 +427,7 @@ E.UIParent:SetFrameLevel(UIParent:GetFrameLevel())
|
||||
E.UIParent:SetPoint("CENTER", UIParent, "CENTER")
|
||||
E.UIParent:SetWidth(GetScreenWidth())
|
||||
E.UIParent:SetHeight(GetScreenHeight())
|
||||
E["snapBars"][getn(E["snapBars"]) + 1] = E.UIParent
|
||||
E.snapBars[getn(E["snapBars"]) + 1] = E.UIParent
|
||||
|
||||
E.HiddenFrame = CreateFrame("Frame")
|
||||
E.HiddenFrame:Hide()
|
||||
@@ -554,6 +564,10 @@ function E:RemoveEmptySubTables(tbl)
|
||||
end
|
||||
end
|
||||
|
||||
--Compare 2 tables and remove duplicate key/value pairs
|
||||
--param cleanTable : table you want cleaned
|
||||
--param checkTable : table you want to check against.
|
||||
--return : a copy of cleanTable with duplicate key/value pairs removed
|
||||
function E:RemoveTableDuplicates(cleanTable, checkTable)
|
||||
if type(cleanTable) ~= "table" then
|
||||
E:Print("Bad argument #1 to 'RemoveTableDuplicates' (table expected)")
|
||||
@@ -569,12 +583,14 @@ function E:RemoveTableDuplicates(cleanTable, checkTable)
|
||||
if type(value) == "table" and checkTable[option] and type(checkTable[option]) == "table" then
|
||||
cleaned[option] = self:RemoveTableDuplicates(value, checkTable[option])
|
||||
else
|
||||
-- Add unique data to our clean table
|
||||
if cleanTable[option] ~= checkTable[option] then
|
||||
cleaned[option] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Clean out empty sub-tables
|
||||
self:RemoveEmptySubTables(cleaned)
|
||||
|
||||
return cleaned
|
||||
@@ -744,18 +760,21 @@ function E:StringSplitMultiDelim(s, delim)
|
||||
assert(type (delim) == "string" and len(delim) > 0, "bad delimiter")
|
||||
|
||||
local start = 1
|
||||
local t = {}
|
||||
local t = {} -- results table
|
||||
|
||||
-- find each instance of a string followed by the delimiter
|
||||
while(true) do
|
||||
local pos = find(s, delim, start, true)
|
||||
local pos = find(s, delim, start, true) -- plain find
|
||||
|
||||
if not pos then
|
||||
break
|
||||
end
|
||||
|
||||
tinsert(t, sub(s, start, pos - 1))
|
||||
start = pos + len(delim)
|
||||
end
|
||||
end -- while
|
||||
|
||||
-- insert final one (after last delimiter)
|
||||
tinsert(t, sub(s, start))
|
||||
|
||||
return unpack(t)
|
||||
@@ -782,13 +801,11 @@ end
|
||||
|
||||
local SendRecieveGroupSize = 0
|
||||
local function SendRecieve()
|
||||
local prefix, message, sender = arg1, arg2, arg4
|
||||
|
||||
if event == "CHAT_MSG_ADDON" then
|
||||
if sender == E.myname then return end
|
||||
if arg4 == E.myname then return end
|
||||
|
||||
if arg1 == "ELVUI_VERSIONCHK" then
|
||||
local msg, ver = tonumber(message), tonumber(E.version)
|
||||
local msg, ver = tonumber(arg2), tonumber(E.version)
|
||||
if msg and (msg > ver) then -- you're outdated D:
|
||||
if not E.recievedOutOfDateMessage then
|
||||
E:Print(L["ElvUI is out of date. You can download the newest version from https://github.com/ElvUI-TBC/ElvUI/"])
|
||||
@@ -829,95 +846,78 @@ f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
f:SetScript("OnEvent", SendRecieve)
|
||||
|
||||
function E:UpdateAll(ignoreInstall)
|
||||
self.private = self.charSettings.profile
|
||||
self.db = self.data.profile
|
||||
self.global = self.data.global
|
||||
self.db.theme = nil
|
||||
self.db.install_complete = nil
|
||||
E.private = E.charSettings.profile
|
||||
E.db = E.data.profile
|
||||
E.global = E.data.global
|
||||
E.db.theme = nil
|
||||
E.db.install_complete = nil
|
||||
|
||||
self:SetMoversPositions()
|
||||
self:UpdateMedia()
|
||||
self:UpdateCooldownSettings("all")
|
||||
E:DBConversions()
|
||||
|
||||
local UF = self:GetModule("UnitFrames")
|
||||
UF.db = self.db.unitframe
|
||||
UF:Update_AllFrames()
|
||||
local ActionBars = E:GetModule("ActionBars")
|
||||
local AFK = E:GetModule("AFK")
|
||||
local Auras = E:GetModule("Auras")
|
||||
local Bags = E:GetModule("Bags")
|
||||
local Blizzard = E:GetModule("Blizzard")
|
||||
local Chat = E:GetModule("Chat")
|
||||
local DataBars = E:GetModule("DataBars")
|
||||
local DataTexts = E:GetModule("DataTexts")
|
||||
local Layout = E:GetModule("Layout")
|
||||
local Minimap = E:GetModule("Minimap")
|
||||
local NamePlates = E:GetModule("NamePlates")
|
||||
local Tooltip = E:GetModule("Tooltip")
|
||||
local UnitFrames = E:GetModule("UnitFrames")
|
||||
|
||||
local CH = self:GetModule("Chat")
|
||||
CH.db = self.db.chat
|
||||
CH:PositionChat(true)
|
||||
CH:SetupChat()
|
||||
CH:UpdateAnchors()
|
||||
|
||||
local AB = self:GetModule("ActionBars")
|
||||
AB.db = self.db.actionbar
|
||||
AB:UpdateButtonSettings()
|
||||
AB:UpdateMicroPositionDimensions()
|
||||
|
||||
local bags = E:GetModule("Bags")
|
||||
bags.db = self.db.bags
|
||||
bags:Layout()
|
||||
bags:Layout(true)
|
||||
bags:SizeAndPositionBagBar()
|
||||
bags:UpdateItemLevelDisplay()
|
||||
bags:UpdateCountDisplay()
|
||||
|
||||
-- local totems = E:GetModule("Totems")
|
||||
-- totems.db = self.db.general.totems
|
||||
-- totems:PositionAndSize()
|
||||
-- totems:ToggleEnable()
|
||||
|
||||
self:GetModule("Layout"):ToggleChatPanels()
|
||||
|
||||
local DT = self:GetModule("DataTexts")
|
||||
DT.db = self.db.datatexts
|
||||
DT:LoadDataTexts()
|
||||
|
||||
-- local NP = self:GetModule("NamePlates")
|
||||
-- NP.db = self.db.nameplates
|
||||
-- NP:StyleFilterInitializeAllFilters()
|
||||
-- NP:ConfigureAll()
|
||||
|
||||
local DataBars = self:GetModule("DataBars")
|
||||
ActionBars.db = E.db.actionbar
|
||||
Auras.db = E.db.auras
|
||||
Bags.db = E.db.bags
|
||||
Chat.db = E.db.chat
|
||||
DataBars.db = E.db.databars
|
||||
DataBars:UpdateDataBarDimensions()
|
||||
DataTexts.db = E.db.datatexts
|
||||
NamePlates.db = E.db.nameplates
|
||||
Tooltip.db = E.db.tooltip
|
||||
UnitFrames.db = E.db.unitframe
|
||||
|
||||
E:SetMoversPositions()
|
||||
|
||||
E:UpdateMedia()
|
||||
E:UpdateBorderColors()
|
||||
E:UpdateBackdropColors()
|
||||
E:UpdateFrameTemplates()
|
||||
E:UpdateStatusBars()
|
||||
E:UpdateCooldownSettings("all")
|
||||
|
||||
Layout:ToggleChatPanels()
|
||||
Layout:BottomPanelVisibility()
|
||||
Layout:TopPanelVisibility()
|
||||
Layout:SetDataPanelStyle()
|
||||
|
||||
ActionBars:UpdateButtonSettings()
|
||||
ActionBars:UpdateMicroPositionDimensions()
|
||||
AFK:Toggle()
|
||||
Bags:Layout()
|
||||
Bags:Layout(true)
|
||||
Bags:SizeAndPositionBagBar()
|
||||
Bags:UpdateCountDisplay()
|
||||
Bags:UpdateItemLevelDisplay()
|
||||
Chat:PositionChat(true)
|
||||
Chat:SetupChat()
|
||||
Chat:UpdateAnchors()
|
||||
DataBars:EnableDisable_ExperienceBar()
|
||||
DataBars:EnableDisable_ReputationBar()
|
||||
DataBars:UpdateDataBarDimensions()
|
||||
DataTexts:LoadDataTexts()
|
||||
Minimap:UpdateSettings()
|
||||
NamePlates:ConfigureAll()
|
||||
UnitFrames:Update_AllFrames()
|
||||
|
||||
-- local T = self:GetModule("Threat")
|
||||
-- T.db = self.db.general.threat
|
||||
-- T:UpdatePosition()
|
||||
-- T:ToggleEnable()
|
||||
|
||||
self:GetModule("Auras").db = self.db.auras
|
||||
self:GetModule("Tooltip").db = self.db.tooltip
|
||||
|
||||
-- if ElvUIPlayerBuffs then
|
||||
-- E:GetModule("Auras"):UpdateHeader(ElvUIPlayerBuffs)
|
||||
-- end
|
||||
|
||||
-- if ElvUIPlayerDebuffs then
|
||||
-- E:GetModule("Auras"):UpdateHeader(ElvUIPlayerDebuffs)
|
||||
-- end
|
||||
|
||||
if not (self.private.install_complete or ignoreInstall) then
|
||||
self:Install()
|
||||
if E.RefreshGUI then
|
||||
E:RefreshGUI()
|
||||
end
|
||||
|
||||
self:GetModule("Minimap"):UpdateSettings()
|
||||
self:GetModule("AFK"):Toggle()
|
||||
|
||||
self:UpdateBorderColors()
|
||||
self:UpdateBackdropColors()
|
||||
|
||||
self:UpdateFrameTemplates()
|
||||
self:UpdateStatusBars()
|
||||
|
||||
local LO = E:GetModule("Layout")
|
||||
LO:ToggleChatPanels()
|
||||
LO:BottomPanelVisibility()
|
||||
LO:TopPanelVisibility()
|
||||
LO:SetDataPanelStyle()
|
||||
if not (self.private.install_complete or ignoreInstall) then
|
||||
E:Install()
|
||||
end
|
||||
|
||||
collectgarbage()
|
||||
end
|
||||
@@ -957,17 +957,16 @@ function E:RegisterModule(name, loadFunc)
|
||||
|
||||
--Add module name to registry
|
||||
self.ModuleCallbacks[name] = true
|
||||
tinsert(self.ModuleCallbacks["CallPriority"], name)
|
||||
self.ModuleCallbacks.CallPriority[getn(self.ModuleCallbacks.CallPriority) + 1] = name
|
||||
|
||||
--Register loadFunc to be called when event is fired
|
||||
E:RegisterCallback(name, loadFunc, E:GetModule(name))
|
||||
end
|
||||
--Old deprecated initialize method
|
||||
else
|
||||
if self.initialized then
|
||||
self:GetModule(name):Initialize()
|
||||
else
|
||||
tinsert(self["RegisteredModules"], name)
|
||||
self.RegisteredModules[getn(self.RegisteredModules) + 1] = name
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -983,26 +982,25 @@ function E:RegisterInitialModule(name, loadFunc)
|
||||
|
||||
--Add module name to registry
|
||||
self.InitialModuleCallbacks[name] = true
|
||||
tinsert(self.InitialModuleCallbacks["CallPriority"], name)
|
||||
self.InitialModuleCallbacks.CallPriority[getn(self.InitialModuleCallbacks.CallPriority) + 1] = name
|
||||
|
||||
--Register loadFunc to be called when event is fired
|
||||
E:RegisterCallback(name, loadFunc, E:GetModule(name))
|
||||
--Old deprecated initialize method
|
||||
else
|
||||
tinsert(self["RegisteredInitialModules"], name)
|
||||
self.RegisteredInitialModules[getn(self.RegisteredInitialModules) + 1] = name
|
||||
end
|
||||
end
|
||||
|
||||
function E:InitializeInitialModules()
|
||||
--Fire callbacks for any module using the new system
|
||||
for index, moduleName in ipairs(self.InitialModuleCallbacks["CallPriority"]) do
|
||||
for index, moduleName in ipairs(self.InitialModuleCallbacks.CallPriority) do
|
||||
self.InitialModuleCallbacks[moduleName] = nil
|
||||
self.InitialModuleCallbacks["CallPriority"][index] = nil
|
||||
self.InitialModuleCallbacks.CallPriority[index] = nil
|
||||
E.callbacks:Fire(moduleName)
|
||||
end
|
||||
|
||||
--Old deprecated initialize method, we keep it for any plugins that may need it
|
||||
for _, module in pairs(E["RegisteredInitialModules"]) do
|
||||
for _, module in pairs(E.RegisteredInitialModules) do
|
||||
module = self:GetModule(module, true)
|
||||
if module and module.Initialize then
|
||||
local _, catch = pcall(module.Initialize, module)
|
||||
@@ -1021,17 +1019,18 @@ end
|
||||
|
||||
function E:InitializeModules()
|
||||
--Fire callbacks for any module using the new system
|
||||
for index, moduleName in ipairs(self.ModuleCallbacks["CallPriority"]) do
|
||||
for index, moduleName in ipairs(self.ModuleCallbacks.CallPriority) do
|
||||
self.ModuleCallbacks[moduleName] = nil
|
||||
self.ModuleCallbacks["CallPriority"][index] = nil
|
||||
self.ModuleCallbacks.CallPriority[index] = nil
|
||||
E.callbacks:Fire(moduleName)
|
||||
end
|
||||
|
||||
--Old deprecated initialize method, we keep it for any plugins that may need it
|
||||
for _, module in pairs(E["RegisteredModules"]) do
|
||||
for _, module in pairs(E.RegisteredModules) do
|
||||
module = self:GetModule(module)
|
||||
if module.Initialize then
|
||||
local _, catch = pcall(module.Initialize, module)
|
||||
|
||||
if catch and GetCVar("ShowErrors") == "1" then
|
||||
ScriptErrorsFrame_OnError(catch, false)
|
||||
end
|
||||
@@ -1041,7 +1040,12 @@ end
|
||||
|
||||
--DATABASE CONVERSIONS
|
||||
function E:DBConversions()
|
||||
-- Add conversions here
|
||||
--Vendor Greys option is now in bags table
|
||||
if E.db.general.vendorGrays then
|
||||
E.db.bags.vendorGrays.enable = E.db.general.vendorGrays
|
||||
E.db.general.vendorGrays = nil
|
||||
E.db.general.vendorGraysDetails = nil
|
||||
end
|
||||
end
|
||||
|
||||
local CPU_USAGE = {}
|
||||
@@ -1060,8 +1064,8 @@ local function CompareCPUDiff(showall, module, minCalls)
|
||||
end
|
||||
newUsage, calls = GetFunctionCPUUsage(mod[newFunc], true)
|
||||
differance = newUsage - oldUsage
|
||||
if showall and calls > minCalls then
|
||||
E:Print(calls, name, differance)
|
||||
if showall and (calls > minCalls) then
|
||||
E:Print('Name('..name..') Calls('..calls..') Diff('..(differance > 0 and format("%.3f", differance) or 0)..')')
|
||||
end
|
||||
if (differance > greatestDiff) and calls > minCalls then
|
||||
greatestName, greatestUsage, greatestCalls, greatestDiff = name, newUsage, calls, differance
|
||||
@@ -1070,10 +1074,12 @@ local function CompareCPUDiff(showall, module, minCalls)
|
||||
end
|
||||
|
||||
if greatestName then
|
||||
E:Print(greatestName .. " had the CPU usage difference of: " .. greatestUsage .. "ms. And has been called " .. greatestCalls .. " times.")
|
||||
E:Print(greatestName.. " had the CPU usage difference of: "..(greatestUsage > 0 and format("%.3f", greatestUsage) or 0).."ms. And has been called ".. greatestCalls.." times.")
|
||||
else
|
||||
E:Print("CPU Usage: No CPU Usage differences found.")
|
||||
end
|
||||
|
||||
twipe(CPU_USAGE)
|
||||
end
|
||||
|
||||
function E:GetTopCPUFunc(msg)
|
||||
@@ -1085,6 +1091,7 @@ function E:GetTopCPUFunc(msg)
|
||||
E:Print("cpuusage: module (arg1) is required! This can be set as 'all' too.")
|
||||
return
|
||||
end
|
||||
|
||||
local module, showall, delay, minCalls = msg:match("^(%S+)%s*(%S*)%s*(%S*)%s*(.*)$")
|
||||
local checkCore, mod = (not module or module == "") and "E"
|
||||
|
||||
@@ -1094,25 +1101,33 @@ function E:GetTopCPUFunc(msg)
|
||||
|
||||
twipe(CPU_USAGE)
|
||||
if module == "all" then
|
||||
for _, registeredModule in pairs(self["RegisteredModules"]) do
|
||||
mod = self:GetModule(registeredModule, true) or self
|
||||
for name in pairs(mod) do
|
||||
if type(mod[name]) == "function" and name ~= "GetModule" then
|
||||
CPU_USAGE[registeredModule .. ":" .. name] = GetFunctionCPUUsage(mod[name], true)
|
||||
for moduName, modu in pairs(self.modules) do
|
||||
for funcName, func in pairs(modu) do
|
||||
if (funcName ~= "GetModule") and (type(func) == "function") then
|
||||
CPU_USAGE[moduName..":"..funcName] = GetFunctionCPUUsage(func, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
mod = self:GetModule(module, true) or self
|
||||
for name in pairs(mod) do
|
||||
if type(mod[name]) == "function" and name ~= "GetModule" then
|
||||
CPU_USAGE[module .. ":" .. name] = GetFunctionCPUUsage(mod[name], true)
|
||||
if not checkCore then
|
||||
mod = self:GetModule(module, true)
|
||||
if not mod then
|
||||
self:Print(module.." not found, falling back to checking core.")
|
||||
mod, checkCore = self, "E"
|
||||
end
|
||||
else
|
||||
mod = self
|
||||
end
|
||||
|
||||
for name, func in pairs(mod) do
|
||||
if (name ~= "GetModule") and type(func) == "function" then
|
||||
CPU_USAGE[(checkCore or module)..":"..name] = GetFunctionCPUUsage(func, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:Delay(delay, CompareCPUDiff, showall, module, minCalls)
|
||||
self:Print("Calculating CPU Usage differences (module: " .. (module or "?") .. ", showall: " .. tostring(showall) .. ", minCalls: " .. tostring(minCalls) .. ", delay: " .. tostring(delay) .. ")")
|
||||
self:Print("Calculating CPU Usage differences (module: "..(checkCore or module)..", showall: "..tostring(showall)..", minCalls: "..tostring(minCalls)..", delay: "..tostring(delay)..")")
|
||||
end
|
||||
|
||||
function E:Initialize()
|
||||
@@ -1126,7 +1141,6 @@ function E:Initialize()
|
||||
self.data.RegisterCallback(self, "OnProfileChanged", "UpdateAll")
|
||||
self.data.RegisterCallback(self, "OnProfileCopied", "UpdateAll")
|
||||
self.data.RegisterCallback(self, "OnProfileReset", "OnProfileReset")
|
||||
|
||||
self.charSettings = LibStub("AceDB-3.0"):New("ElvPrivateDB", self.privateVars)
|
||||
self.private = self.charSettings.profile
|
||||
self.db = self.data.profile
|
||||
@@ -1137,9 +1151,9 @@ function E:Initialize()
|
||||
-- self:ScheduleTimer("CheckRole", 0.01)
|
||||
self:UIScale("PLAYER_LOGIN")
|
||||
|
||||
self:LoadCommands()
|
||||
self:InitializeModules()
|
||||
self:LoadMovers()
|
||||
self:LoadCommands() --Load Commands
|
||||
self:InitializeModules() --Load Modules
|
||||
self:LoadMovers() --Load Movers
|
||||
self:UpdateCooldownSettings("all")
|
||||
self.initialized = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user