update tables

This commit is contained in:
Crum
2018-12-06 19:55:03 -06:00
parent cb90d0f1e5
commit 4d0cc6c85c
68 changed files with 705 additions and 597 deletions
@@ -259,17 +259,17 @@ function UF:HeaderConfig(header, configMode)
end
end
UF["headerFunctions"][header.groupName]:AdjustVisibility(header)
UF.headerFunctions[header.groupName]:AdjustVisibility(header)
end
function UF:PLAYER_REGEN_DISABLED()
for _, header in pairs(UF["headers"]) do
for _, header in pairs(UF.headers) do
if header.forceShow then
self:HeaderConfig(header)
end
end
for _, unit in pairs(UF["units"]) do
for _, unit in pairs(UF.units) do
local frame = self[unit]
if frame and frame.forceShow then
self:UnforceShow(frame)
@@ -24,7 +24,7 @@ function UF:Construct_AuraBars()
E:SetTemplate(self, "Default", nil, nil, UF.thinBorders, true)
local inset = UF.thinBorders and E.mult or nil
E:SetInside(bar, self, inset, inset)
UF["statusbars"][bar] = true
UF.statusbars[bar] = true
UF:Update_StatusBar(bar)
UF:Configure_FontString(bar.spelltime)
+4 -4
View File
@@ -79,7 +79,7 @@ function UF:Construct_AuraIcon(button)
if auraName then
E:Print(format(L["The spell '%s' has been added to the Blacklist unitframe aura filter."], auraName))
E.global["unitframe"]["aurafilters"]["Blacklist"]["spells"][auraName] = {
E.global.unitframe.aurafilters.Blacklist.spells[auraName] = {
["enable"] = true,
["priority"] = 0,
}
@@ -319,8 +319,8 @@ function UF:UpdateAuraIconSettings(auras, noCycle)
if not frame.db then return end
local db = frame.db[type]
local unitframeFont = LSM:Fetch("font", E.db["unitframe"].font)
local unitframeFontOutline = E.db["unitframe"].fontOutline
local unitframeFont = LSM:Fetch("font", E.db.unitframe.font)
local unitframeFontOutline = E.db.unitframe.fontOutline
local index = 1
auras.db = db
if db then
@@ -421,7 +421,7 @@ function UF:UpdateAuraTimer(elapsed)
if self.text:GetFont() then
self.text:SetText(format("%s%s|r", E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue)
elseif self:GetParent():GetParent().db then
E:FontTemplate(self.text, LSM:Fetch("font", E.db["unitframe"].font), self:GetParent():GetParent().db[self:GetParent().type].fontSize, E.db["unitframe"].fontOutline)
E:FontTemplate(self.text, LSM:Fetch("font", E.db.unitframe.font), self:GetParent():GetParent().db[self:GetParent().type].fontSize, E.db.unitframe.fontOutline)
self.text:SetText(format("%s%s|r", E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue)
end
end
@@ -30,7 +30,7 @@ local INVERT_ANCHORPOINT = {
function UF:Construct_Castbar(frame, moverName)
local castbar = CreateFrame("StatusBar", nil, frame)
castbar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 30) --Make it appear above everything else
self["statusbars"][castbar] = true
self.statusbars[castbar] = true
castbar.CustomDelayText = self.CustomCastDelayText
castbar.CustomTimeText = self.CustomTimeText
castbar.PostCastStart = self.PostCastStart
+2 -2
View File
@@ -13,7 +13,7 @@ assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_PowerBar(frame, bg, text, textPos)
local power = CreateFrame("StatusBar", nil, frame)
UF["statusbars"][power] = true
UF.statusbars[power] = true
power.PostUpdate = self.PostUpdatePower
@@ -22,7 +22,7 @@ function UF:Construct_PowerBar(frame, bg, text, textPos)
if bg then
power.bg = power:CreateTexture(nil, "BORDER")
power.bg:SetAllPoints()
power.bg:SetTexture(E["media"].blankTex)
power.bg:SetTexture(E.media.blankTex)
power.bg.multiplier = 0.2
end
+3 -3
View File
@@ -35,7 +35,7 @@ function UF:Construct_PartyFrames()
UF:Update_StatusBars()
UF:Update_FontStrings()
UF:Update_PartyFrames(self, UF.db["units"]["party"])
UF:Update_PartyFrames(self, UF.db.units.party)
return self;
end
@@ -59,7 +59,7 @@ function UF:Update_PartyHeader(header)
header:RegisterEvent("PARTY_MEMBERS_CHANGED")
header:RegisterEvent("RAID_ROSTER_UPDATE")
header:SetScript("OnEvent", UF["PartySmartVisibility"])
header:SetScript("OnEvent", UF.PartySmartVisibility)
header.positioned = true
end
@@ -136,4 +136,4 @@ function UF:Update_PartyFrames(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
UF["headerstoload"]["party"] = true
UF.headerstoload.party = true
+3 -3
View File
@@ -37,7 +37,7 @@ function UF:Construct_RaidFrames()
UF:Update_FontStrings()
self.unitframeType = "raid"
UF:Update_RaidFrames(self, UF.db["units"]["raid"])
UF:Update_RaidFrames(self, UF.db.units.raid)
return self
end
@@ -61,7 +61,7 @@ function UF:Update_RaidHeader(header)
header:RegisterEvent("PARTY_MEMBERS_CHANGED")
header:RegisterEvent("RAID_ROSTER_UPDATE")
header:SetScript("OnEvent", UF["RaidSmartVisibility"])
header:SetScript("OnEvent", UF.RaidSmartVisibility)
header.positioned = true
end
@@ -140,4 +140,4 @@ function UF:Update_RaidFrames(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
UF["headerstoload"]["raid"] = true
UF.headerstoload.raid = true
+6 -6
View File
@@ -161,7 +161,7 @@ ElvUF.Tags.Methods["health:deficit-percent:name"] = function(unit)
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit);
else
return _TAGS["name"](unit);
return _TAGS.name(unit);
end
end
@@ -215,11 +215,11 @@ end
ElvUF.Tags.Events["powercolor"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["powercolor"] = function(unit)
local color = ElvUF["colors"].power[UnitPowerType(unit)]
local color = ElvUF.colors.power[UnitPowerType(unit)]
if color then
return Hex(color[1], color[2], color[3])
else
return Hex(unpack(ElvUF["colors"].power[0]))
return Hex(unpack(ElvUF.colors.power[0]))
end
end
@@ -271,8 +271,8 @@ ElvUF.Tags.Methods["power:max"] = function(unit)
end
ElvUF.Tags.Methods["manacolor"] = function()
local altR, altG, altB = PowerBarColor["MANA"].r, PowerBarColor["MANA"].g, PowerBarColor["MANA"].b
local color = ElvUF["colors"].power["MANA"]
local altR, altG, altB = PowerBarColor.MANA.r, PowerBarColor.MANA.g, PowerBarColor.MANA.b
local color = ElvUF.colors.power[0]
if color then
return Hex(color[1], color[2], color[3])
else
@@ -358,7 +358,7 @@ ElvUF.Tags.Methods["namecolor"] = function(unit)
if not class then return "" end
return Hex(class[1], class[2], class[3])
elseif (unitReaction) then
local reaction = ElvUF["colors"].reaction[unitReaction]
local reaction = ElvUF.colors.reaction[unitReaction]
return Hex(reaction[1], reaction[2], reaction[3])
else
return "|cFFC2C2C2"
+65 -65
View File
@@ -24,37 +24,37 @@ local ns = oUF
ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
UF["headerstoload"] = {}
UF["unitstoload"] = {}
UF.headerstoload = {}
UF.unitstoload = {}
UF["groupPrototype"] = {}
UF["headerPrototype"] = {}
UF["headers"] = {}
UF["units"] = {}
UF.groupPrototype = {}
UF.headerPrototype = {}
UF.headers = {}
UF.units = {}
UF["statusbars"] = {}
UF["fontstrings"] = {}
UF["badHeaderPoints"] = {
UF.statusbars = {}
UF.fontstrings = {}
UF.badHeaderPoints = {
["TOP"] = "BOTTOM",
["LEFT"] = "RIGHT",
["BOTTOM"] = "TOP",
["RIGHT"] = "LEFT"
}
UF["headerFunctions"] = {}
UF.headerFunctions = {}
UF["classMaxResourceBar"] = {
UF.classMaxResourceBar = {
["DRUID"] = 1
}
UF["mapIDs"] = {
UF.mapIDs = {
[443] = 10, -- Warsong Gulch
[461] = 15, -- Arathi Basin
[401] = 40, -- Alterac Valley
[566] = 15, -- Eye of the Storm
}
UF["headerGroupBy"] = {
UF.headerGroupBy = {
["CLASS"] = function(header)
header:SetAttribute("groupingOrder", "DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR")
header:SetAttribute("sortMethod", "NAME")
@@ -325,7 +325,7 @@ end
function UF:Update_StatusBars()
local statusBarTexture = LSM:Fetch("statusbar", self.db.statusbar)
for statusbar in pairs(UF["statusbars"]) do
for statusbar in pairs(UF.statusbars) do
if statusbar and statusbar:GetObjectType() == "StatusBar" and not statusbar.isTransparent then
statusbar:SetStatusBarTexture(statusBarTexture)
elseif statusbar and statusbar:GetObjectType() == "Texture" then
@@ -344,24 +344,24 @@ end
function UF:Update_FontStrings()
local stringFont = LSM:Fetch("font", self.db.font)
for font in pairs(UF["fontstrings"]) do
for font in pairs(UF.fontstrings) do
E:FontTemplate(font, stringFont, self.db.fontSize, self.db.fontOutline)
end
end
function UF:Configure_FontString(obj)
UF["fontstrings"][obj] = true
UF.fontstrings[obj] = true
E:FontTemplate(obj) --This is temporary.
end
function UF:Update_AllFrames()
if E.private["unitframe"].enable ~= true then return; end
if E.private.unitframe.enable ~= true then return; end
self:UpdateColors()
self:Update_FontStrings()
self:Update_StatusBars()
for unit in pairs(self["units"]) do
if self.db["units"][unit].enable then
for unit in pairs(self.units) do
if self.db.units[unit].enable then
self[unit]:Enable()
self[unit]:Update()
E:EnableMover(self[unit].mover:GetName())
@@ -519,9 +519,9 @@ end
function UF.groupPrototype:Update(self)
local group = self.groupName
UF[group].db = UF.db["units"][group]
UF[group].db = UF.db.units[group]
for i = 1, getn(self.groups) do
self.groups[i].db = UF.db["units"][group]
self.groups[i].db = UF.db.units[group]
self.groups[i]:Update()
end
end
@@ -548,7 +548,7 @@ end
function UF.groupPrototype:UpdateHeader(self)
local group = self.groupName;
UF["Update_"..E:StringTitle(group).."Header"](UF, self, UF.db["units"][group]);
UF["Update_"..E:StringTitle(group).."Header"](UF, self, UF.db.units[group]);
end
function UF.headerPrototype:ClearChildPoints()
@@ -560,7 +560,7 @@ end
function UF.headerPrototype:Update(isForced)
local group = self.groupName
local db = UF.db["units"][group]
local db = UF.db.units[group]
local i = 1
local child = self:GetAttribute("child" .. i)
@@ -609,7 +609,7 @@ end
function UF:CreateHeader(parent, groupFilter, overrideName, template, groupName, headerTemplate)
local group = parent.groupName or groupName
local db = UF.db["units"][group]
local db = UF.db.units[group]
ElvUF:SetActiveStyle("ElvUF_"..E:StringTitle(group))
local header = ElvUF:SpawnHeader(overrideName, headerTemplate, nil,
"groupFilter", groupFilter,
@@ -630,7 +630,7 @@ function UF:CreateHeader(parent, groupFilter, overrideName, template, groupName,
end
function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdate, headerTemplate)
local db = self.db["units"][group]
local db = self.db.units[group]
local numGroups = db.numGroups
if not self[group] then
@@ -645,16 +645,16 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
self[group].groupName = group
self[group].template = self[group].template or template
self[group].headerTemplate = self[group].headerTemplate or headerTemplate
if not UF["headerFunctions"][group] then UF["headerFunctions"][group] = {} end
if not UF.headerFunctions[group] then UF.headerFunctions[group] = {} end
for k, v in pairs(self.groupPrototype) do
UF["headerFunctions"][group][k] = v
UF.headerFunctions[group][k] = v
end
else
self[group] = self:CreateHeader(E.UIParent, groupFilter, "ElvUF_"..E:StringTitle(group), template, group, headerTemplate)
end
self[group].db = db
self["headers"][group] = self[group]
self.headers[group] = self[group]
self[group]:Show()
end
@@ -671,17 +671,17 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
end
end
UF["headerFunctions"][group]:AdjustVisibility(self[group])
UF.headerFunctions[group]:AdjustVisibility(self[group])
if headerUpdate or not self[group].mover then
UF["headerFunctions"][group]:Configure_Groups(self[group])
UF.headerFunctions[group]:Configure_Groups(self[group])
if not self[group].isForced and not self[group].blockVisibilityChanges then
-- RegisterStateDriver(self[group], "visibility", db.visibility)
end
else
UF["headerFunctions"][group]:Configure_Groups(self[group])
UF["headerFunctions"][group]:UpdateHeader(self[group])
UF["headerFunctions"][group]:Update(self[group])
UF.headerFunctions[group]:Configure_Groups(self[group])
UF.headerFunctions[group]:UpdateHeader(self[group])
UF.headerFunctions[group]:Update(self[group])
end
if db.enable then
@@ -700,9 +700,9 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
else
self[group].db = db
if not UF["headerFunctions"][group] then UF["headerFunctions"][group] = {} end
UF["headerFunctions"][group]["Update"] = function()
local db = UF.db["units"][group]
if not UF.headerFunctions[group] then UF.headerFunctions[group] = {} end
UF.headerFunctions[group]["Update"] = function()
local db = UF.db.units[group]
if db.enable ~= true then
--UnregisterStateDriver(UF[group], "visibility")
UF[group]:Hide()
@@ -715,14 +715,14 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
for i = 1, UF[group]:GetNumChildren() do
local child = select(i, UF[group]:GetChildren())
UF["Update_"..E:StringTitle(group).."Frames"](UF, child, UF.db["units"][group])
UF["Update_"..E:StringTitle(group).."Frames"](UF, child, UF.db.units[group])
if _G[child:GetName().."Target"] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName().."Target"], UF.db["units"][group])
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName().."Target"], UF.db.units[group])
end
if _G[child:GetName().."Pet"] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName().."Pet"], UF.db["units"][group])
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName().."Pet"], UF.db.units[group])
end
end
@@ -732,7 +732,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
if headerUpdate then
UF["Update_"..E:StringTitle(group).."Header"](self, self[group], db)
else
UF["headerFunctions"][group]:Update(self[group])
UF.headerFunctions[group]:Update(self[group])
end
end
end
@@ -749,14 +749,14 @@ function UF:CreateAndUpdateUF(unit)
frameName = gsub(frameName, "t(arget)", "T%1")
if not self[unit] then
self[unit] = ElvUF:Spawn(unit, "ElvUF_"..frameName)
self["units"][unit] = unit
self.units[unit] = unit
end
self[unit].Update = function()
UF["Update_"..frameName.."Frame"](self, self[unit], self.db["units"][unit])
UF["Update_"..frameName.."Frame"](self, self[unit], self.db.units[unit])
end
if self.db["units"][unit].enable then
if self.db.units[unit].enable then
self[unit]:Enable()
self[unit].Update()
E:EnableMover(self[unit].mover:GetName())
@@ -767,12 +767,12 @@ function UF:CreateAndUpdateUF(unit)
end
function UF:LoadUnits()
for _, unit in pairs(self["unitstoload"]) do
for _, unit in pairs(self.unitstoload) do
self:CreateAndUpdateUF(unit)
end
self["unitstoload"] = nil
self.unitstoload = nil
for group, groupOptions in pairs(self["headerstoload"]) do
for group, groupOptions in pairs(self.headerstoload) do
local groupFilter, template, headerTemplate
if type(groupOptions) == "table" then
groupFilter, template, headerTemplate = unpack(groupOptions)
@@ -780,7 +780,7 @@ function UF:LoadUnits()
self:CreateAndUpdateHeaderGroup(group, groupFilter, template, nil, headerTemplate)
end
self["headerstoload"] = nil
self.headerstoload = nil
end
function UF:UpdateAllHeaders(event)
@@ -796,15 +796,15 @@ function UF:UpdateAllHeaders(event)
end
end
if E.private["unitframe"]["disabledBlizzardFrames"].party then
if E.private.unitframe.disabledBlizzardFrames.party then
ElvUF:DisableBlizzard("party")
end
for group, header in pairs(self["headers"]) do
for group, header in pairs(self.headers) do
if header.numGroups then
UF["headerFunctions"][group]:UpdateHeader(header)
UF.headerFunctions[group]:UpdateHeader(header)
end
UF["headerFunctions"][group]:Update(header)
UF.headerFunctions[group]:Update(header)
if group == "party" or group == "raid" then
--Update BuffIndicators on profile change as they might be using profile specific data
@@ -851,19 +851,19 @@ end
function ElvUF:DisableBlizzard(unit)
if not unit then return end
if(unit == "player") and E.private["unitframe"]["disabledBlizzardFrames"].player then
if(unit == "player") and E.private.unitframe.disabledBlizzardFrames.player then
HandleFrame(PlayerFrame)
elseif(unit == "pet") and E.private["unitframe"]["disabledBlizzardFrames"].player then
elseif(unit == "pet") and E.private.unitframe.disabledBlizzardFrames.player then
HandleFrame(PetFrame)
elseif(unit == "target") and E.private["unitframe"]["disabledBlizzardFrames"].target then
elseif(unit == "target") and E.private.unitframe.disabledBlizzardFrames.target then
HandleFrame(TargetFrame)
HandleFrame(ComboFrame)
-- elseif(unit == "focus") and E.private["unitframe"]["disabledBlizzardFrames"].focus then
-- elseif(unit == "focus") and E.private.unitframe.disabledBlizzardFrames.focus then
-- HandleFrame(FocusFrame)
-- HandleFrame(FocusFrameToT)
elseif(unit == "targettarget") and E.private["unitframe"]["disabledBlizzardFrames"].target then
elseif(unit == "targettarget") and E.private.unitframe.disabledBlizzardFrames.target then
HandleFrame(TargetofTargetFrame)
elseif string.match(unit, "(party)%d?$") == "party" and E.private["unitframe"]["disabledBlizzardFrames"].party then
elseif string.match(unit, "(party)%d?$") == "party" and E.private.unitframe.disabledBlizzardFrames.party then
local id = string.match(unit, "party(%d)")
if id then
HandleFrame("PartyMemberFrame"..id)
@@ -892,9 +892,9 @@ function UF:PLAYER_ENTERING_WORLD()
end
function UF:Initialize()
self.db = E.db["unitframe"]
self.db = E.db.unitframe
self.thinBorders = self.db.thinBorders or E.PixelMode
if E.private["unitframe"].enable ~= true then return; end
if E.private.unitframe.enable ~= true then return; end
E.UnitFrames = UF
self:UpdateColors()
@@ -915,14 +915,14 @@ function UF:Initialize()
end
function UF:ResetUnitSettings(unit)
E:CopyTable(self.db["units"][unit], P["unitframe"]["units"][unit])
E:CopyTable(self.db.units[unit], P.unitframe.units[unit])
if self.db["units"][unit].buffs and self.db["units"][unit].buffs.sizeOverride then
self.db["units"][unit].buffs.sizeOverride = P.unitframe.units[unit].buffs.sizeOverride or 0
if self.db.units[unit].buffs and self.db.units[unit].buffs.sizeOverride then
self.db.units[unit].buffs.sizeOverride = P.unitframe.units[unit].buffs.sizeOverride or 0
end
if self.db["units"][unit].debuffs and self.db["units"][unit].debuffs.sizeOverride then
self.db["units"][unit].debuffs.sizeOverride = P.unitframe.units[unit].debuffs.sizeOverride or 0
if self.db.units[unit].debuffs and self.db.units[unit].debuffs.sizeOverride then
self.db.units[unit].debuffs.sizeOverride = P.unitframe.units[unit].debuffs.sizeOverride or 0
end
self:Update_AllFrames()
@@ -958,7 +958,7 @@ local allowPass = {
}
function UF:MergeUnitSettings(fromUnit, toUnit, isGroupUnit)
local db = self.db["units"]
local db = self.db.units
local filter = ignoreSettings
if isGroupUnit then
filter = ignoreSettingsGroup
+1 -1
View File
@@ -86,4 +86,4 @@ function UF:Update_PetFrame(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "pet")
tinsert(UF.unitstoload, "pet")
+1 -1
View File
@@ -83,4 +83,4 @@ function UF:Update_PetTargetFrame(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "pettarget")
tinsert(UF.unitstoload, "pettarget")
+1 -1
View File
@@ -113,4 +113,4 @@ function UF:Update_PlayerFrame(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "player")
tinsert(UF.unitstoload, "player")
+1 -1
View File
@@ -102,4 +102,4 @@ function UF:Update_TargetFrame(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "target")
tinsert(UF.unitstoload, "target")
@@ -82,4 +82,4 @@ function UF:Update_TargetTargetFrame(frame, db)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "targettarget")
tinsert(UF.unitstoload, "targettarget")