mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
More WIP
This commit is contained in:
@@ -5,7 +5,7 @@ local LSM = LibStub("LibSharedMedia-3.0");
|
|||||||
--Cache global variables
|
--Cache global variables
|
||||||
--Lua functions
|
--Lua functions
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local find, format = string.find, string.format
|
local find, format, lower = string.find, string.format, string.lower
|
||||||
local strsplit = strsplit
|
local strsplit = strsplit
|
||||||
local tsort, getn = table.sort, table.getn
|
local tsort, getn = table.sort, table.getn
|
||||||
local ceil = math.ceil
|
local ceil = math.ceil
|
||||||
@@ -77,7 +77,11 @@ function UF:Construct_AuraIcon(button)
|
|||||||
|
|
||||||
button:RegisterForClicks("RightButtonUp")
|
button:RegisterForClicks("RightButtonUp")
|
||||||
button:SetScript("OnClick", function(self)
|
button:SetScript("OnClick", function(self)
|
||||||
if E.db.unitframe.auraBlacklistModifier == "NONE" or not ((E.db.unitframe.auraBlacklistModifier == "SHIFT" and IsShiftKeyDown()) or (E.db.unitframe.auraBlacklistModifier == "ALT" and IsAltKeyDown()) or (E.db.unitframe.auraBlacklistModifier == "CTRL" and IsControlKeyDown())) then return; end
|
if E.db.unitframe.auraBlacklistModifier == "NONE"
|
||||||
|
or not ((E.db.unitframe.auraBlacklistModifier == "SHIFT" and IsShiftKeyDown())
|
||||||
|
or (E.db.unitframe.auraBlacklistModifier == "ALT" and IsAltKeyDown())
|
||||||
|
or (E.db.unitframe.auraBlacklistModifier == "CTRL" and IsControlKeyDown())) then return end
|
||||||
|
|
||||||
local auraName = self.name
|
local auraName = self.name
|
||||||
|
|
||||||
if auraName then
|
if auraName then
|
||||||
@@ -116,7 +120,7 @@ function UF:Configure_Auras(frame, auraType)
|
|||||||
local db = frame.db
|
local db = frame.db
|
||||||
|
|
||||||
local auras = frame[auraType]
|
local auras = frame[auraType]
|
||||||
auraType = auraType:lower()
|
auraType = lower(auraType)
|
||||||
local rows = db[auraType].numrows
|
local rows = db[auraType].numrows
|
||||||
|
|
||||||
local totalWidth = frame.UNIT_WIDTH - frame.SPACING*2
|
local totalWidth = frame.UNIT_WIDTH - frame.SPACING*2
|
||||||
@@ -138,7 +142,8 @@ function UF:Configure_Auras(frame, auraType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local attachTo = self:GetAuraAnchorFrame(frame, db[auraType].attachTo, db.debuffs.attachTo == "BUFFS" and db.buffs.attachTo == "DEBUFFS")
|
local attachTo = self:GetAuraAnchorFrame(frame, db[auraType].attachTo, db.debuffs.attachTo == "BUFFS" and db.buffs.attachTo == "DEBUFFS")
|
||||||
local x, y = E:GetXYOffset(db[auraType].anchorPoint, frame.SPACING) --Use frame.SPACING override since it may be different from E.Spacing due to forced thin borders
|
--Use frame.SPACING override since it may be different from E.Spacing due to forced thin borders
|
||||||
|
local x, y = E:GetXYOffset(db[auraType].anchorPoint, frame.SPACING)
|
||||||
|
|
||||||
if db[auraType].attachTo == "FRAME" then
|
if db[auraType].attachTo == "FRAME" then
|
||||||
y = 0
|
y = 0
|
||||||
@@ -151,7 +156,7 @@ function UF:Configure_Auras(frame, auraType)
|
|||||||
x = 0
|
x = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if (auraType == "buffs" and frame.Debuffs.attachTo and frame.Debuffs.attachTo == frame.Buffs and db[auraType].attachTo == "DEBUFFS") then
|
if auraType == "buffs" and frame.Debuffs.attachTo and frame.Debuffs.attachTo == frame.Buffs and db[auraType].attachTo == "DEBUFFS" then
|
||||||
--Update Debuffs first, as we would otherwise get conflicting anchor points
|
--Update Debuffs first, as we would otherwise get conflicting anchor points
|
||||||
--This is usually only an issue on profile change
|
--This is usually only an issue on profile change
|
||||||
ReverseUpdate(frame)
|
ReverseUpdate(frame)
|
||||||
@@ -219,13 +224,13 @@ function UF:Configure_Auras(frame, auraType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SortAurasByTime(a, b)
|
local function SortAurasByTime(a, b)
|
||||||
if (a and b and a:GetParent().db) then
|
if a and b and a:GetParent().db then
|
||||||
if a:IsShown() and b:IsShown() then
|
if a:IsShown() and b:IsShown() then
|
||||||
local sortDirection = a:GetParent().db.sortDirection
|
local sortDirection = a:GetParent().db.sortDirection
|
||||||
local aTime = a.expiration or -1
|
local aTime = a.expiration or -1
|
||||||
local bTime = b.expiration or -1
|
local bTime = b.expiration or -1
|
||||||
if (aTime and bTime) then
|
if aTime and bTime then
|
||||||
if(sortDirection == "DESCENDING") then
|
if sortDirection == "DESCENDING" then
|
||||||
return aTime < bTime
|
return aTime < bTime
|
||||||
else
|
else
|
||||||
return aTime > bTime
|
return aTime > bTime
|
||||||
@@ -238,13 +243,13 @@ local function SortAurasByTime(a, b)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SortAurasByName(a, b)
|
local function SortAurasByName(a, b)
|
||||||
if (a and b and a:GetParent().db) then
|
if a and b and a:GetParent().db then
|
||||||
if a:IsShown() and b:IsShown() then
|
if a:IsShown() and b:IsShown() then
|
||||||
local sortDirection = a:GetParent().db.sortDirection
|
local sortDirection = a:GetParent().db.sortDirection
|
||||||
local aName = a.spell or ""
|
local aName = a.spell or ""
|
||||||
local bName = b.spell or ""
|
local bName = b.spell or ""
|
||||||
if (aName and bName) then
|
if aName and bName then
|
||||||
if(sortDirection == "DESCENDING") then
|
if sortDirection == "DESCENDING" then
|
||||||
return aName < bName
|
return aName < bName
|
||||||
else
|
else
|
||||||
return aName > bName
|
return aName > bName
|
||||||
@@ -257,13 +262,13 @@ local function SortAurasByName(a, b)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SortAurasByDuration(a, b)
|
local function SortAurasByDuration(a, b)
|
||||||
if (a and b and a:GetParent().db) then
|
if a and b and a:GetParent().db then
|
||||||
if a:IsShown() and b:IsShown() then
|
if a:IsShown() and b:IsShown() then
|
||||||
local sortDirection = a:GetParent().db.sortDirection
|
local sortDirection = a:GetParent().db.sortDirection
|
||||||
local aTime = a.duration or -1
|
local aTime = a.duration or -1
|
||||||
local bTime = b.duration or -1
|
local bTime = b.duration or -1
|
||||||
if (aTime and bTime) then
|
if aTime and bTime then
|
||||||
if(sortDirection == "DESCENDING") then
|
if sortDirection == "DESCENDING" then
|
||||||
return aTime < bTime
|
return aTime < bTime
|
||||||
else
|
else
|
||||||
return aTime > bTime
|
return aTime > bTime
|
||||||
@@ -276,12 +281,12 @@ local function SortAurasByDuration(a, b)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function SortAurasByCaster(a, b)
|
local function SortAurasByCaster(a, b)
|
||||||
if (a and b and a:GetParent().db) then
|
if a and b and a:GetParent().db then
|
||||||
if a:IsShown() and b:IsShown() then
|
if a:IsShown() and b:IsShown() then
|
||||||
local sortDirection = a:GetParent().db.sortDirection
|
local sortDirection = a:GetParent().db.sortDirection
|
||||||
local aPlayer = a.isPlayer or false
|
local aPlayer = a.isPlayer or false
|
||||||
local bPlayer = b.isPlayer or false
|
local bPlayer = b.isPlayer or false
|
||||||
if(sortDirection == "DESCENDING") then
|
if sortDirection == "DESCENDING" then
|
||||||
return (aPlayer and not bPlayer)
|
return (aPlayer and not bPlayer)
|
||||||
else
|
else
|
||||||
return (not aPlayer and bPlayer)
|
return (not aPlayer and bPlayer)
|
||||||
@@ -296,13 +301,13 @@ function UF:SortAuras()
|
|||||||
if not self.db then return end
|
if not self.db then return end
|
||||||
|
|
||||||
--Sorting by Index is Default
|
--Sorting by Index is Default
|
||||||
if(self.db.sortMethod == "TIME_REMAINING") then
|
if self.db.sortMethod == "TIME_REMAINING" then
|
||||||
tsort(self, SortAurasByTime)
|
tsort(self, SortAurasByTime)
|
||||||
elseif(self.db.sortMethod == "NAME") then
|
elseif self.db.sortMethod == "NAME" then
|
||||||
tsort(self, SortAurasByName)
|
tsort(self, SortAurasByName)
|
||||||
elseif(self.db.sortMethod == "DURATION") then
|
elseif self.db.sortMethod == "DURATION" then
|
||||||
tsort(self, SortAurasByDuration)
|
tsort(self, SortAurasByDuration)
|
||||||
elseif (self.db.sortMethod == "PLAYER") then
|
elseif self.db.sortMethod == "PLAYER" then
|
||||||
tsort(self, SortAurasByCaster)
|
tsort(self, SortAurasByCaster)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -314,20 +319,20 @@ end
|
|||||||
function UF:UpdateAuraIconSettings(auras, noCycle)
|
function UF:UpdateAuraIconSettings(auras, noCycle)
|
||||||
local frame = auras:GetParent()
|
local frame = auras:GetParent()
|
||||||
local type = auras.type
|
local type = auras.type
|
||||||
if(noCycle) then
|
if noCycle then
|
||||||
frame = auras:GetParent():GetParent()
|
frame = auras:GetParent():GetParent()
|
||||||
type = auras:GetParent().type
|
type = auras:GetParent().type
|
||||||
end
|
end
|
||||||
if(not frame.db) then return end
|
if not frame.db then return end
|
||||||
|
|
||||||
local db = frame.db[type]
|
local db = frame.db[type]
|
||||||
local unitframeFont = LSM:Fetch("font", E.db["unitframe"].font)
|
local unitframeFont = LSM:Fetch("font", E.db["unitframe"].font)
|
||||||
local unitframeFontOutline = E.db["unitframe"].fontOutline
|
local unitframeFontOutline = E.db["unitframe"].fontOutline
|
||||||
local index = 1
|
local index = 1
|
||||||
auras.db = db
|
auras.db = db
|
||||||
if(db) then
|
if db then
|
||||||
if(not noCycle) then
|
if not noCycle then
|
||||||
while(auras[index]) do
|
while auras[index] do
|
||||||
local button = auras[index]
|
local button = auras[index]
|
||||||
button.text:FontTemplate(unitframeFont, db.fontSize, unitframeFontOutline)
|
button.text:FontTemplate(unitframeFont, db.fontSize, unitframeFontOutline)
|
||||||
button.count:FontTemplate(unitframeFont, db.countFontSize or db.fontSize, unitframeFontOutline)
|
button.count:FontTemplate(unitframeFont, db.countFontSize or db.fontSize, unitframeFontOutline)
|
||||||
@@ -352,8 +357,6 @@ function UF:UpdateAuraIconSettings(auras, noCycle)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local unstableAffliction = GetSpellInfo(30108)
|
|
||||||
local vampiricTouch = GetSpellInfo(34914)
|
|
||||||
function UF:PostUpdateAura(unit, button)
|
function UF:PostUpdateAura(unit, button)
|
||||||
local auras = button:GetParent()
|
local auras = button:GetParent()
|
||||||
local frame = auras:GetParent()
|
local frame = auras:GetParent()
|
||||||
@@ -374,11 +377,7 @@ function UF:PostUpdateAura(unit, button)
|
|||||||
button.icon:SetDesaturated((unit and not find(unit, "arena%d")) and true or false)
|
button.icon:SetDesaturated((unit and not find(unit, "arena%d")) and true or false)
|
||||||
else
|
else
|
||||||
local color = (button.dtype and DebuffTypeColor[button.dtype]) or DebuffTypeColor.none
|
local color = (button.dtype and DebuffTypeColor[button.dtype]) or DebuffTypeColor.none
|
||||||
if button.name and (button.name == unstableAffliction or button.name == vampiricTouch) and E.myclass ~= "WARLOCK" then
|
|
||||||
button:SetBackdropBorderColor(0.05, 0.85, 0.94)
|
|
||||||
else
|
|
||||||
button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
|
button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
|
||||||
end
|
|
||||||
button.icon:SetDesaturated(false)
|
button.icon:SetDesaturated(false)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -429,7 +428,7 @@ function UF:UpdateAuraTimer(elapsed)
|
|||||||
if self.expirationSaved <= 0 then
|
if self.expirationSaved <= 0 then
|
||||||
self:SetScript("OnUpdate", nil)
|
self:SetScript("OnUpdate", nil)
|
||||||
|
|
||||||
if(self.text:GetFont()) then
|
if self.text:GetFont() then
|
||||||
self.text:SetText("")
|
self.text:SetText("")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -448,7 +447,7 @@ end
|
|||||||
|
|
||||||
function UF:AuraFilter(unit, button, name, _, _, _, dispelType, duration, expiration, caster, isStealable, _, spellID)
|
function UF:AuraFilter(unit, button, name, _, _, _, dispelType, duration, expiration, caster, isStealable, _, spellID)
|
||||||
local db = self:GetParent().db
|
local db = self:GetParent().db
|
||||||
if not db or not db[self.type] then return true; end
|
if not db or not db[self.type] then return true end
|
||||||
|
|
||||||
db = db[self.type]
|
db = db[self.type]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user