test nameplate

This commit is contained in:
Bunny67
2018-07-27 21:59:25 +03:00
parent 7418e8cf74
commit 362eae4448
7 changed files with 492 additions and 202 deletions
+131 -25
View File
@@ -1,39 +1,124 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("NamePlates");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
--WoW API / Variables
local CreateFrame = CreateFrame
--[[
Target Glow Style Option Variables
style1 - Border
style2 - Background
style3 - Top Arrow Only
style4 - Side Arrows Only
style5 - Border + Top Arrow
style6 - Background + Top Arrow
style7 - Border + Side Arrows
style8 - Background + Side Arrows
]]
function mod:UpdatePoisiton_Arrow(frame, shouldShow)
if frame.TopArrow and (shouldShow ~= 2) and (self.db.targetGlow == "style3" or self.db.targetGlow == "style5" or self.db.targetGlow == "style6") then -- top arrow
local topArrowSpace = -3
if self.db.units[frame.UnitType].showName and (frame.Name:GetText() ~= nil and frame.Name:GetText() ~= "") then
topArrowSpace = self.db.fontSize + topArrowSpace
end
frame.TopArrow:SetPoint("BOTTOM", frame.HealthBar, "TOP", 0, topArrowSpace)
if shouldShow then
frame.TopArrow:Show()
end
end
if (frame.LeftArrow and frame.RightArrow) and (shouldShow ~= 2) and (self.db.targetGlow == "style4" or self.db.targetGlow == "style7" or self.db.targetGlow == "style8") then -- side arrows
frame.RightArrow:SetPoint("RIGHT", frame.HealthBar, "LEFT", 3, 0)
frame.LeftArrow:SetPoint("LEFT", frame.HealthBar, "RIGHT", -3, 0)
if shouldShow then
frame.RightArrow:Show()
frame.LeftArrow:Show()
end
end
end
function mod:UpdatePosition_Glow(frame, shouldShow)
local castBar = frame.CastBar and frame.CastBar:IsShown() and frame.CastBar
local iconPosition = castBar and (castBar.Icon and castBar.Icon:IsShown()) and (frame.UnitType and self.db.units[frame.UnitType].castbar.iconPosition)
if frame.Glow and (self.db.targetGlow == "style1" or self.db.targetGlow == "style5" or self.db.targetGlow == "style7") then -- original glow
local offset = (E.PixelMode and E.mult*6) or E.mult*8 -- edgeSize is 6 (not attached to the backdrop needs +1 for pixel mode or +3 for non pixel mode)
if self.db.units[frame.UnitType].castbar.offset < 4 then
E:SetOutside(frame.Glow, (iconPosition == "LEFT" and castBar.Icon) or frame.HealthBar, offset, offset, (iconPosition == "RIGHT" and castBar.Icon) or castBar)
else
E:SetOutside(frame.Glow, frame.HealthBar, offset, offset)
end
if shouldShow then
frame.Glow:Show()
end
end
if frame.Glow2 and (self.db.targetGlow == "style2" or self.db.targetGlow == "style6" or self.db.targetGlow == "style8") then -- new background glow
local scale = 1
if self.db.useTargetScale then
if self.db.targetScale >= 0.75 then
scale = self.db.targetScale
else
scale = 0.75
end
end
local size = (E.Border+14+(castBar and 3 or 0))*scale
frame.Glow2:SetPoint("TOPLEFT", (iconPosition == "LEFT" and castBar.Icon) or frame.HealthBar, "TOPLEFT", -(size*2), size)
frame.Glow2:SetPoint("BOTTOMRIGHT", (iconPosition == "RIGHT" and castBar.Icon) or castBar or frame.HealthBar, "BOTTOMRIGHT", size*2, -size)
if shouldShow then
frame.Glow2:Show()
end
end
end
function mod:UpdateElement_Glow(frame)
if frame.TopArrow:IsShown() then frame.TopArrow:Hide() end
if frame.LeftArrow:IsShown() then frame.LeftArrow:Hide() end
if frame.RightArrow:IsShown() then frame.RightArrow:Hide() end
if frame.Glow2:IsShown() then frame.Glow2:Hide() end
if frame.Glow:IsShown() then frame.Glow:Hide() end
if not frame.HealthBar:IsShown() then return end
local r, g, b, shouldShow
if frame.isTarget and self.db.useTargetGlow then
r, g, b = 1, 1, 1
shouldShow = true
else
local shouldShow, r, g, b, a = 0
if frame.isTarget and self.db.targetGlow ~= "none" then
r, g, b, a = self.db.glowColor.r, self.db.glowColor.g, self.db.glowColor.b, self.db.glowColor.a
shouldShow = 1
elseif self.db.lowHealthThreshold > 0 then
local health = frame.oldHealthBar:GetValue()
local _, maxHealth = frame.oldHealthBar:GetMinMaxValues()
local perc = health / maxHealth
if perc <= self.db.lowHealthThreshold then
if perc <= self.db.lowHealthThreshold / 2 then
r, g, b = 1, 0, 0
r, g, b, a = 1, 0, 0, 1
else
r, g, b = 1, 1, 0
r, g, b, a = 1, 1, 0, 1
end
shouldShow = true
shouldShow = 2
end
end
if shouldShow then
frame.Glow:Show()
if r ~= frame.Glow.r or g ~= frame.Glow.g or b ~= frame.Glow.b then
frame.Glow:SetBackdropBorderColor(r, g, b)
frame.Glow.r, frame.Glow.g, frame.Glow.b = r, g, b
if shouldShow ~= 0 then
self:UpdatePosition_Glow(frame, shouldShow)
self:UpdatePoisiton_Arrow(frame, shouldShow)
if frame.Glow and (r ~= frame.Glow.r or g ~= frame.Glow.g or b ~= frame.Glow.b or a ~= frame.Glow.a) then
frame.Glow:SetBackdropBorderColor(r, g, b, a)
frame.Glow2:SetVertexColor(r, g, b, a)
frame.TopArrow:SetVertexColor(r, g, b, a)
frame.LeftArrow:SetVertexColor(r, g, b, a)
frame.RightArrow:SetVertexColor(r, g, b, a)
frame.Glow.r, frame.Glow.g, frame.Glow.b, frame.Glow.a = r, g, b, a
end
elseif frame.Glow:IsShown() then
frame.Glow:Hide()
end
end
@@ -44,13 +129,34 @@ end
function mod:ConstructElement_Glow(frame)
local f = CreateFrame("Frame", nil, frame)
f:SetFrameLevel(frame.HealthBar:GetFrameLevel() - 1)
E:SetOutside(f, frame.HealthBar, 3, 3)
f:SetBackdrop({
edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(3),
insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}
})
f:SetScale(E.PixelMode and 1.5 or 2)
f:SetBackdrop({edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(6)})
f:Hide()
local glow = frame:CreateTexture(nil, "BACKGROUND")
glow:SetTexture([[Interface\AddOns\ElvUI\media\textures\spark.tga]])
glow:Hide()
frame.Glow2 = glow
local top = frame:CreateTexture(nil, "BACKGROUND")
top:SetTexture([[Interface\AddOns\ElvUI\media\textures\nameplateTargetIndicator.tga]])
top:SetWidth(45)
top:SetHeight(45)
top:Hide()
frame.TopArrow = top
local left = frame:CreateTexture(nil, "BACKGROUND")
left:SetTexture([[Interface\AddOns\ElvUI\media\textures\nameplateTargetIndicatorLeft.tga]])
left:SetWidth(45)
left:SetHeight(45)
left:Hide()
frame.LeftArrow = left
local right = frame:CreateTexture(nil, "BACKGROUND")
right:SetTexture([[Interface\AddOns\ElvUI\media\textures\nameplateTargetIndicatorRight.tga]])
right:SetWidth(45)
right:SetHeight(45)
right:Hide()
frame.RightArrow = right
return f
end
@@ -165,7 +165,15 @@ end
function mod:ConstructElement_HealthBar(parent)
local frame = CreateFrame("StatusBar", nil, parent)
self:StyleFrame(frame)
frame:SetFrameLevel(parent:GetFrameLevel())
frame:SetScript("OnSizeChanged", function()
parent:SetWidth(this:GetWidth())
parent:SetHeight(this:GetHeight())
local health = this:GetValue()
local _, maxHealth = this:GetMinMaxValues()
this:GetStatusBarTexture():SetPoint("TOPRIGHT", -(this:GetWidth() * ((maxHealth - health) / maxHealth)), 0)
end)
frame.text = frame:CreateFontString(nil, "OVERLAY")
frame.scale = CreateAnimationGroup(frame)
@@ -0,0 +1,43 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("NamePlates");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
--WoW API / Variables
function mod:UpdateElement_Highlight(frame)
if frame:IsShown() and frame.isMouseover and (frame.NameOnlyChanged or (not self.db.units[frame.UnitType].healthbar.enable and self.db.units[frame.UnitType].showName)) and not frame.isTarget then
frame.Name.NameOnlyGlow:Show()
frame.Highlight:Show()
elseif frame:IsShown() and frame.isMouseover and (not frame.NameOnlyChanged or self.db.units[frame.UnitType].healthbar.enable) and not frame.isTarget then
frame.Highlight.texture:ClearAllPoints()
frame.Highlight.texture:SetPoint("TOPLEFT", frame.HealthBar, "TOPLEFT")
frame.Highlight.texture:SetPoint("BOTTOMRIGHT", frame.HealthBar:GetStatusBarTexture(), "BOTTOMRIGHT")
frame.Highlight.texture:Show()
frame.Highlight:Show()
else
frame.Name.NameOnlyGlow:Hide()
frame.Highlight.texture:Hide()
frame.Highlight:Hide()
end
end
function mod:ConfigureElement_Highlight(frame)
if not self.db.units[frame.UnitType].healthbar.enable then return end
frame.Highlight.texture:SetTexture(LSM:Fetch("statusbar", self.db.statusbar))
end
function mod:ConstructElement_Highlight(frame)
local f = CreateFrame("Frame", nil, frame)
f.texture = frame.HealthBar:CreateTexture(nil, "ARTWORK")
f.texture:SetVertexColor(1, 1, 1, 0.3)
f.texture:Hide()
f:SetScript("OnHide", function()
frame.Name.NameOnlyGlow:Hide()
frame.Highlight.texture:Hide()
end)
return f
end
@@ -8,4 +8,5 @@
<Script file="Name.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="HealerIcon.lua"/>
<Script file="Highlight.lua"/>
</Ui>
+16 -1
View File
@@ -36,6 +36,12 @@ function mod:UpdateElement_Name(frame)
else
frame.Name:SetTextColor(1, 1, 1)
end
if self.db.nameColoredGlow then
frame.Name.NameOnlyGlow:SetVertexColor(r - 0.1, g - 0.1, b - 0.1, 1)
else
frame.Name.NameOnlyGlow:SetVertexColor(self.db.glowColor.r, self.db.glowColor.g, self.db.glowColor.b, self.db.glowColor.a)
end
end
function mod:ConfigureElement_Name(frame)
@@ -44,7 +50,7 @@ function mod:ConfigureElement_Name(frame)
name:SetJustifyH("LEFT")
name:SetJustifyV("BOTTOM")
name:ClearAllPoints()
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
if(self.db.units[frame.UnitType].healthbar.enable or (self.db.alwaysShowTargetHealth and frame.isTarget)) then
name:SetJustifyH("LEFT")
name:SetPoint("BOTTOMLEFT", frame.HealthBar, "TOPLEFT", 0, E.Border*2)
name:SetPoint("BOTTOMRIGHT", frame.Level, "BOTTOMLEFT")
@@ -58,6 +64,15 @@ end
function mod:ConstructElement_Name(frame)
local name = frame:CreateFontString(nil, "OVERLAY")
name:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
local g = frame:CreateTexture(nil, "BACKGROUND")
g:SetTexture([[Interface\AddOns\ElvUI\media\textures\spark.tga]])
g:Hide()
g:SetPoint("TOPLEFT", name, -20, 8)
g:SetPoint("BOTTOMRIGHT", name, 20, -8)
name.NameOnlyGlow = g
return name
end
+223 -133
View File
@@ -20,7 +20,6 @@ local WorldFrame = WorldFrame
local WorldGetNumChildren, WorldGetChildren = WorldFrame.GetNumChildren, WorldFrame.GetChildren
local numChildren = 0
local isTarget = false
local BORDER = "Interface\\Tooltips\\Nameplate-Border"
local FSPAT = "^%s*$"
local queryList = {}
@@ -46,7 +45,6 @@ local healClasses = {
mod.CreatedPlates = {}
mod.VisiblePlates = {}
mod.Healers = {}
function mod:CheckFilter(frame)
--[[local db = E.global.nameplates["filter"][frame.UnitName]
@@ -78,18 +76,42 @@ function mod:CheckFilter(frame)
return true
end
function mod:CheckBGHealers()
local name, class, damageDone, healingDone, _
for i = 1, GetNumBattlefieldScores() do
name, _, _, _, _, _, _, _, _, class, damageDone, healingDone = GetBattlefieldScore(i)
if name and class and healClasses[class] then
name = match(name, "(.+)%-.+") or name
if name and healingDone > (damageDone * 2) then
self.Healers[name] = true
elseif name and self.Healers[name] then
self.Healers[name] = nil
end
function mod:GetPlateFrameLevel(frame)
local plateLevel
if frame.plateID then
plateLevel = frame.plateID*mod.levelStep
end
return plateLevel
end
function mod:SetPlateFrameLevel(frame, level, isTarget)
if frame and level then
if isTarget then
level = 890 --10 higher than the max calculated level of 880
elseif frame.FrameLevelChanged then
--calculate Style Filter FrameLevelChanged leveling
--level method: (10*(40*2)) max 800 + max 80 (40*2) = max 880
--highest possible should be level 880 and we add 1 to all so 881
local leveledCount = mod.CollectedFrameLevelCount or 1
level = (frame.FrameLevelChanged*(40*mod.levelStep)) + (leveledCount*mod.levelStep)
end
frame:SetFrameLevel(level+1)
frame.HealthBar:SetFrameLevel(level+3)
frame.Glow:SetFrameLevel(frame:GetFrameLevel()-1)
frame.Buffs:SetFrameLevel(level+1)
frame.Debuffs:SetFrameLevel(level+1)
end
end
function mod:ResetNameplateFrameLevel(frame)
local isTarget = frame.isTarget --frame.isTarget is not the same here so keep this.
local plateLevel = mod:GetPlateFrameLevel(frame)
if plateLevel then
if frame.FrameLevelChanged then --keep how many plates we change, this is reset to 1 post-ResetNameplateFrameLevel
mod.CollectedFrameLevelCount = (mod.CollectedFrameLevelCount and mod.CollectedFrameLevelCount + 1) or 1
end
self:SetPlateFrameLevel(frame, plateLevel, isTarget)
end
end
@@ -106,75 +128,109 @@ function mod:SetFrameScale(frame, scale)
end
function mod:SetTargetFrame(frame)
if isTarget then return end
if frame.isTarget then
if not frame.isTargetChanged then
frame.isTargetChanged = true
mod:SetPlateFrameLevel(frame, mod:GetPlateFrameLevel(frame), true)
if self.db.useTargetScale then
self:SetFrameScale(frame, (frame.ThreatScale or 1) * self.db.targetScale)
end
if not frame.isGroupUnit then
frame.unit = "target"
-- self:RegisterEvents(frame)
end
if self.db.units[frame.UnitType].healthbar.enable ~= true and self.db.alwaysShowTargetHealth then
frame.Name:ClearAllPoints()
frame.Level:ClearAllPoints()
frame.HealthBar.r, frame.HealthBar.g, frame.HealthBar.b = nil, nil, nil
self:ConfigureElement_HealthBar(frame)
-- self:ConfigureElement_CastBar(frame)
-- self:ConfigureElement_Glow(frame)
-- self:ConfigureElement_Elite(frame)
-- self:ConfigureElement_Highlight(frame)
self:ConfigureElement_Level(frame)
self:ConfigureElement_Name(frame)
-- self:RegisterEvents(frame)
self:UpdateElement_All(frame, true)
end
if self.hasTarget then
frame:SetAlpha(1)
end
-- TEST
-- mod:UpdateElement_Highlight(frame)
-- mod:UpdateElement_CPoints(frame)
-- mod:UpdateElement_Filters(frame, "PLAYER_TARGET_CHANGED")
-- mod:ForEachPlate("ResetNameplateFrameLevel") --keep this after `UpdateElement_Filters`
end
elseif frame.isTargetChanged then
frame.isTargetChanged = false
mod:SetPlateFrameLevel(frame, mod:GetPlateFrameLevel(frame))
local targetExists = UnitExists("target") == 1
if targetExists and frame:GetParent():IsShown() and frame:GetParent():GetAlpha() == 1 then
if self.db.useTargetScale then
self:SetFrameScale(frame, (frame.CustomScale and frame.CustomScale * self.db.targetScale) or self.db.targetScale)
end
frame.isTarget = true
frame.unit = "target"
if self.db.units[frame.UnitType].healthbar.enable ~= true then
frame.Name:ClearAllPoints()
frame.Level:ClearAllPoints()
frame.HealthBar.r, frame.HealthBar.g, frame.HealthBar.b = nil, nil, nil
self:ConfigureElement_HealthBar(frame)
self:ConfigureElement_CastBar(frame)
self:ConfigureElement_Glow(frame)
self:ConfigureElement_Level(frame)
self:ConfigureElement_Name(frame)
self:UpdateElement_All(frame, true)
self:SetFrameScale(frame, (frame.ThreatScale or 1))
end
--[[if UnitCastingInfo("target") then
frame:GetScript("OnEvent")(frame, "UNIT_SPELLCAST_START", "target")
elseif UnitChannelInfo("target") then
frame:GetScript("OnEvent")(frame, "UNIT_SPELLCAST_CHANNEL_START", "target")
end]]
frame:SetAlpha(1)
mod:UpdateElement_AurasByUnitID("target")
elseif frame.isTarget then
if self.db.useTargetScale then
self:SetFrameScale(frame, frame.CustomScale or frame.ThreatScale or 1)
if not frame.isGroupUnit then
frame.unit = nil
-- frame:UnregisterAllEvents()
end
frame.isTarget = nil
frame.unit = nil
-- frame.guid = nil
if self.db.units[frame.UnitType].healthbar.enable ~= true then
self:UpdateAllFrame(frame)
end
if targetExists then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
if not frame.AlphaChanged then
if self.hasTarget then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
end
end
-- TEST
-- mod:UpdateElement_CPoints(frame)
-- mod:UpdateElement_Filters(frame, "PLAYER_TARGET_CHANGED")
-- mod:ForEachPlate("ResetNameplateFrameLevel") --keep this after `UpdateElement_Filters`
elseif frame.oldHighlight:IsShown() then
if not frame.isMouseover then
frame.isMouseover = true
if not frame.isGroupUnit then
frame.unit = "mouseover"
-- mod:UpdateElement_AurasByGUID(frame.guid)
-- mod:UpdateElement_Highlight(frame)
end
end
-- mod:UpdateElement_Cast(frame, nil, frame.unit)
elseif frame.isMouseover then
frame.isMouseover = nil
if not frame.isGroupUnit then
frame.unit = nil
-- frame.CastBar:Hide()
end
--mod:UpdateElement_Highlight(frame)
else
if targetExists then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
if not frame.AlphaChanged then
if self.hasTarget then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
end
end
end
mod:UpdateElement_HealthColor(frame)
mod:UpdateElement_Glow(frame)
mod:UpdateElement_CPoints(frame)
return frame.isTarget
end
function mod:GetNumVisiblePlates()
local i = 0
for _ in pairs(mod.VisiblePlates) do
i = i + 1
end
return i
--self:UpdateElement_Glow(frame)
--self:UpdateElement_HealthColor(frame)
end
function mod:StyleFrame(parent, noBackdrop, point)
@@ -331,8 +387,6 @@ function mod:GetUnitInfo(frame)
end
function mod:OnShow(self)
isTarget = false
self:SetWidth(0.01)
self:SetHeight(0.01)
@@ -353,11 +407,7 @@ function mod:OnShow(self)
self.UnitFrame.UnitType = unitType
end
if not mod:CheckFilter(self.UnitFrame) then return end
if unitType == "ENEMY_PLAYER" then
mod:UpdateElement_HealerIcon(self.UnitFrame)
end
--if not mod:CheckFilter(self.UnitFrame) then return end
self.UnitFrame.Level:ClearAllPoints()
self.UnitFrame.Name:ClearAllPoints()
@@ -407,32 +457,43 @@ function mod:OnHide(self)
mod.VisiblePlates[self.UnitFrame] = nil
self.UnitFrame.unit = nil
--self.UnitFrame.isGroupUnit = nil
mod:HideAuraIcons(self.UnitFrame.Buffs)
mod:HideAuraIcons(self.UnitFrame.Debuffs)
--mod:ClearStyledPlate(self.UnitFrame)
self.UnitFrame:UnregisterAllEvents()
self.UnitFrame.Glow.r, self.UnitFrame.Glow.g, self.UnitFrame.Glow.b = nil, nil, nil
self.UnitFrame.Glow:Hide()
self.UnitFrame.Glow2:Hide()
self.UnitFrame.TopArrow:Hide()
self.UnitFrame.LeftArrow:Hide()
self.UnitFrame.RightArrow:Hide()
self.UnitFrame.HealthBar.r, self.UnitFrame.HealthBar.g, self.UnitFrame.HealthBar.b = nil, nil, nil
self.UnitFrame.HealthBar:Hide()
--self.UnitFrame.CastBar:Hide()
self.UnitFrame.HealthBar.currentScale = nil
self.UnitFrame.Level:ClearAllPoints()
self.UnitFrame.Level:SetText("")
self.UnitFrame.Name.r, self.UnitFrame.Name.g, self.UnitFrame.Name.b = nil, nil, nil
self.UnitFrame.Name:ClearAllPoints()
self.UnitFrame.Name:SetText("")
self.UnitFrame.Name.NameOnlyGlow:Hide()
self.UnitFrame.Highlight:Hide()
self.UnitFrame.CPoints:Hide()
self.UnitFrame:Hide()
self.UnitFrame.isTarget = nil
self.UnitFrame.displayedUnit = nil
self.ThreatData = nil
self.UnitFrame.isTargetChanged = false
self.UnitFrame.isMouseover = nil
self.UnitFrame.UnitName = nil
self.UnitFrame.UnitType = nil
self.UnitFrame.UnitClass = nil
self.UnitFrame.UnitReaction = nil
self.UnitFrame.TopLevelFrame = nil
self.UnitFrame.TopOffset = nil
self.UnitFrame.ThreatScale = nil
self.UnitFrame.ActionScale = nil
self.UnitFrame.ThreatReaction = nil
self.UnitFrame.guid = nil
self.UnitFrame.RaidIconType = nil
self.UnitFrame.CustomColor = nil
self.UnitFrame.CustomScale = nil
end
function mod:UpdateAllFrame(frame)
@@ -455,60 +516,81 @@ function mod:ForEachPlate(functionToRun, ...)
end
end
function mod:UpdateElement_All(frame, noTargetFrame)
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
self:UpdateElement_Health(frame)
self:UpdateElement_HealthColor(frame)
self:UpdateElement_Auras(frame)
end
self:UpdateElement_RaidIcon(frame)
self:UpdateElement_HealerIcon(frame)
self:UpdateElement_Name(frame)
self:UpdateElement_Level(frame)
if not noTargetFrame then
mod:ScheduleTimer("ForEachPlate", 0.25, "SetTargetFrame")
function mod:ForEachVisiblePlate(functionToRun, ...)
for frame in pairs(self.VisiblePlates) do
self[functionToRun](self, frame, unpack(arg))
end
end
function mod:UpdateElement_All(frame, noTargetFrame, filterIgnore)
local healthShown = (frame.UnitType and self.db.units[frame.UnitType].healthbar.enable) or (frame.isTarget and self.db.alwaysShowTargetHealth)
if healthShown then
mod:UpdateElement_Health(frame)
mod:UpdateElement_HealthColor(frame)
mod:UpdateElement_Cast(frame, nil, frame.unit)
mod:UpdateElement_Auras(frame)
end
mod:UpdateElement_RaidIcon(frame)
mod:UpdateElement_Name(frame)
mod:UpdateElement_Level(frame)
mod:UpdateElement_Highlight(frame)
if healthShown then
mod:UpdateElement_Glow(frame)
else
-- make sure we hide the arrows and/or glow after disabling the healthbar
if frame.TopArrow and frame.TopArrow:IsShown() then frame.TopArrow:Hide() end
if frame.LeftArrow and frame.LeftArrow:IsShown() then frame.LeftArrow:Hide() end
if frame.RightArrow and frame.RightArrow:IsShown() then frame.RightArrow:Hide() end
if frame.Glow2 and frame.Glow2:IsShown() then frame.Glow2:Hide() end
if frame.Glow and frame.Glow:IsShown() then frame.Glow:Hide() end
end
if not noTargetFrame then
mod:SetTargetFrame(frame)
end
if not filterIgnore then
-- mod:UpdateElement_Filters(frame, "UpdateElement_All")
end
end
local plateID = 0
function mod:OnCreated(frame)
isTarget = false
local HealthBar, CastBar = frame:GetChildren()
plateID = plateID + 1
local HealthBar = frame:GetChildren()
local Border, Highlight, Name, Level, BossIcon, RaidIcon = frame:GetRegions()
frame.UnitFrame = CreateFrame("Button", nil, frame)
frame.UnitFrame = CreateFrame("Button", format("ElvUI_NamePlate%d", plateID), frame)
E:Size(frame.UnitFrame, 100, 20)
frame.UnitFrame:SetPoint("CENTER", 0, 0)
frame.UnitFrame.plateID = plateID
frame.UnitFrame:SetScript("OnEvent", self.OnEvent)
frame.UnitFrame:SetScript("OnClick", function()
frame:Click()
end)
frame.UnitFrame.HealthBar = self:ConstructElement_HealthBar(frame.UnitFrame)
frame.UnitFrame.CastBar = self:ConstructElement_CastBar(frame.UnitFrame)
frame.UnitFrame.Level = self:ConstructElement_Level(frame.UnitFrame)
frame.UnitFrame.Name = self:ConstructElement_Name(frame.UnitFrame)
frame.UnitFrame.CastBar = self:ConstructElement_CastBar(frame.UnitFrame)
frame.UnitFrame.Glow = self:ConstructElement_Glow(frame.UnitFrame)
frame.UnitFrame.Buffs = self:ConstructElement_Auras(frame.UnitFrame, "LEFT")
frame.UnitFrame.Debuffs = self:ConstructElement_Auras(frame.UnitFrame, "RIGHT")
frame.UnitFrame.HealerIcon = self:ConstructElement_HealerIcon(frame.UnitFrame)
frame.UnitFrame.CPoints = self:ConstructElement_CPoints(frame.UnitFrame)
frame.UnitFrame.Highlight = self:ConstructElement_Highlight(frame.UnitFrame)
--self:QueueObject(CastBarBorder)
--self:QueueObject(CastBarIcon)
self:QueueObject(HealthBar)
--self:QueueObject(CastBar)
self:QueueObject(Level)
self:QueueObject(Name)
self:QueueObject(Border)
self:QueueObject(Highlight)
--CastBar:Kill()
--CastBarIcon:SetParent(E.HiddenFrame)
BossIcon:SetAlpha(0)
frame.UnitFrame.oldHealthBar = HealthBar
frame.UnitFrame.oldCastBar = CastBar
--frame.UnitFrame.oldCastBar.Icon = CastBarIcon
frame.UnitFrame.oldName = Name
frame.UnitFrame.oldHighlight = Highlight
frame.UnitFrame.oldLevel = Level
@@ -548,32 +630,45 @@ function mod:QueueObject(object)
object:Hide()
end
function mod:OnUpdate(elapsed)
function mod:GetChildren(...)
local count = WorldGetNumChildren(WorldFrame)
if count ~= numChildren then
local frame, region
for i = numChildren + 1, count do
local frame = select(i, WorldGetChildren(WorldFrame))
local region = frame:GetRegions()
if(not mod.CreatedPlates[frame] and region and region:GetObjectType() == "Texture" and region:GetTexture() == BORDER) then
frame = arg[i]
region = frame:GetRegions()
if not mod.CreatedPlates[frame] and region and region:GetObjectType() == "Texture" and region:GetTexture() == BORDER then
mod:OnCreated(frame)
end
numChildren = count
end
end
end
function mod:OnUpdate()
local count = WorldGetNumChildren(WorldFrame)
if count ~= numChildren then
local frame, region
for i = numChildren + 1, count do
frame = select(i, WorldGetChildren(WorldFrame))
region = frame:GetRegions()
if not mod.CreatedPlates[frame] and region and region:GetObjectType() == "Texture" and region:GetTexture() == BORDER then
mod:OnCreated(frame)
end
numChildren = count
end
numChildren = count
end
local i = 0
for frame in pairs(mod.VisiblePlates) do
i = i + 1
local getTarget = mod:SetTargetFrame(frame)
if not getTarget then
frame:GetParent():SetAlpha(1)
if mod.hasTarget then
frame.alpha = frame:GetParent():GetAlpha()
else
frame.alpha = 1
end
if i == mod:GetNumVisiblePlates() then
isTarget = true
end
frame:GetParent():SetAlpha(1)
frame.isTarget = mod.hasTarget and frame.alpha == 1
end
end
@@ -651,21 +746,10 @@ end
function mod:PLAYER_ENTERING_WORLD()
self:CleanAuraLists()
twipe(self.Healers)
local inInstance, instanceType = IsInInstance()
if inInstance and instanceType == "pvp" and self.db.units.ENEMY_PLAYER.markHealers then
self.CheckHealerTimer = self:ScheduleRepeatingTimer("CheckBGHealers", 3)
self:CheckBGHealers()
else
if self.CheckHealerTimer then
self:CancelTimer(self.CheckHealerTimer)
self.CheckHealerTimer = nil
end
end
end
function mod:PLAYER_TARGET_CHANGED()
isTarget = false
self.hasTarget = UnitExists("target") == 1
end
function mod:UNIT_AURA(_, unit)
@@ -731,6 +815,10 @@ function mod:Initialize()
self.db = E.db["nameplates"]
if E.private["nameplates"].enable ~= true then return end
self.hasTarget = false
self.levelStep = 2
self:UpdateCVars()
self.Frame = CreateFrame("Frame"):SetScript("OnUpdate", self.OnUpdate)
@@ -745,6 +833,8 @@ function mod:Initialize()
self:RegisterMessage("ClassCacheQueryResult")
self:ScheduleRepeatingTimer("ForEachVisiblePlate", 0.1, "SetTargetFrame")
E.NamePlates = self
end
+69 -42
View File
@@ -99,23 +99,42 @@ P["databars"] = {
P["nameplates"] = {
["statusbar"] = "ElvUI Norm",
["font"] = "Homespun",
["fontSize"] = 8,
["fontOutline"] = "MONOCHROMEOUTLINE",
["font"] = "PT Sans Narrow",
["fontSize"] = 11,
["fontOutline"] = "OUTLINE",
["healthFont"] = "PT Sans Narrow",
["healthFontSize"] = 11,
["healthFontOutline"] = "OUTLINE",
["durationFont"] = "PT Sans Narrow",
["durationFontSize"] = 10,
["durationFontOutline"] = "OUTLINE",
["durationPosition"] = "CENTER",
["stackFont"] = "PT Sans Narrow",
["stackFontSize"] = 8,
["stackFontOutline"] = "OUTLINE",
["useTargetScale"] = true,
["targetScale"] = 1.15,
["nonTargetTransparency"] = 0.35,
["motionType"] = "OVERLAP",
["lowHealthThreshold"] = 0.4,
["showFriendlyCombat"] = "DISABLED",
["showEnemyCombat"] = "DISABLED",
["clampToScreen"] = false,
["useTargetGlow"] = true,
["targetGlow"] = "style2",
["glowColor"] = {r = 77/255, g = 179/255, b = 255/255, a = 1},
["nameColoredGlow"] = false,
["alwaysShowTargetHealth"] = true,
["castColor"] = {r = 1, g = 208/255, b = 0},
["castNoInterruptColor"] = {r = 0.78, g = 0.25, b = 0.25},
["comboPoints"] = true,
["cooldown"] = {
["threshold"] = 4,
["override"] = true,
["expiringColor"] = {r = 1, g = 0, b = 0},
["secondsColor"] = {r = 1, g = 1, b = 1},
["minutesColor"] = {r = 1, g = 1, b = 1},
["hoursColor"] = {r = 1, g = 1, b = 1},
["daysColor"] = {r = 1, g = 1, b = 1},
},
["reactions"] = {
["friendlyPlayer"] = {r = 0.31, g = 0.45, b = 0.63},
["tapped"] = {r = 0.6, g = 0.6, b = 0.6},
@@ -128,12 +147,19 @@ P["nameplates"] = {
["badColor"] = {r = 0.78, g = 0.25, b = 0.25},
["goodTransition"] = {r = 218/255, g = 197/255, b = 92/255},
["badTransition"] = {r = 235/255, g = 163/255, b = 40/255},
["beingTankedByTankColor"] = {r = .8, g = 0.1,b = 1},
["beingTankedByTankColor"] = {r = .8, g = 0.1, b = 1},
["beingTankedByTank"] = true,
["goodScale"] = 0.8,
["badScale"] = 1.2,
["useThreatColor"] = true,
},
["filters"] = {
["Boss"] = {
["triggers"] = {
["enable"] = true,
},
},
},
["units"] = {
["FRIENDLY_PLAYER"] = {
@@ -158,15 +184,16 @@ P["nameplates"] = {
["hideTime"] = false,
["castTimeFormat"] = "CURRENT",
["channelTimeFormat"] = "CURRENT",
["timeToHold"] = 0
["timeToHold"] = 0,
["iconPosition"] = "RIGHT",
},
["buffs"] = {
["enable"] = true,
["numAuras"] = 4,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "TurtleBuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,blockNoDuration,Personal,TurtleBuffs" --NamePlate FriendlyPlayer Buffs
},
},
["debuffs"] = {
@@ -174,9 +201,9 @@ P["nameplates"] = {
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "CCDebuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,blockNoDuration,Personal,CCDebuffs" --NamePlate FriendlyPlayer Debuffs
},
},
["name"] = {
@@ -206,16 +233,17 @@ P["nameplates"] = {
["hideTime"] = false,
["castTimeFormat"] = "CURRENT",
["channelTimeFormat"] = "CURRENT",
["timeToHold"] = 0
["timeToHold"] = 0,
["iconPosition"] = "RIGHT",
},
["buffs"] = {
["enable"] = true,
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "TurtleBuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,PlayerBuffs,TurtleBuffs" --NamePlate EnemyPlayer Buffs
},
},
["debuffs"] = {
@@ -223,9 +251,9 @@ P["nameplates"] = {
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "CCDebuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,blockNoDuration,Personal,CCDebuffs,RaidDebuffs" --NamePlate EnemyPlayer Debuffs
},
},
["name"] = {
@@ -253,16 +281,17 @@ P["nameplates"] = {
["hideTime"] = false,
["castTimeFormat"] = "CURRENT",
["channelTimeFormat"] = "CURRENT",
["timeToHold"] = 0
["timeToHold"] = 0,
["iconPosition"] = "RIGHT",
},
["buffs"] = {
["enable"] = true,
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "TurtleBuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,blockNoDuration,Personal,TurtleBuffs" --NamePlate FriendlyNPC Buffs
},
},
["debuffs"] = {
@@ -270,9 +299,9 @@ P["nameplates"] = {
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "CCDebuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,CCDebuffs,RaidDebuffs" --NamePlate FriendlyNPC Debuffs
},
},
["eliteIcon"] = {
@@ -304,16 +333,17 @@ P["nameplates"] = {
["hideTime"] = false,
["castTimeFormat"] = "CURRENT",
["channelTimeFormat"] = "CURRENT",
["timeToHold"] = 0
["timeToHold"] = 0,
["iconPosition"] = "RIGHT",
},
["buffs"] = {
["enable"] = true,
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "TurtleBuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,blockNoDuration,PlayerBuffs,TurtleBuffs" --NamePlate EnemyNPC Buffs
},
},
["debuffs"] = {
@@ -321,9 +351,9 @@ P["nameplates"] = {
["numAuras"] = 4,
["baseHeight"] = 18,
["filters"] = {
["personal"] = true,
["maxDuration"] = 120,
["filter"] = "CCDebuffs"
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,Personal,CCDebuffs" --NamePlate EnemyNPC Debuffs
},
},
["eliteIcon"] = {
@@ -333,11 +363,8 @@ P["nameplates"] = {
["xOffset"] = 15,
["yOffset"] = 0,
},
["detection"] = {
["enable"] = true,
}
}
}
},
},
};
--Auras