local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore if not E.private.unitframe.enable then return end local UF = E:GetModule('UnitFrames'); local SLE = E:GetModule('SLE'); --Setting the variable for using classbar. Elv's function. local CAN_HAVE_CLASSBAR = (E.myclass == "PALADIN" or E.myclass == "DRUID" or E.myclass == "DEATHKNIGHT" or E.myclass == "WARLOCK" or E.myclass == "PRIEST" or E.myclass == "MONK" or E.myclass == 'MAGE') --Function to move damn combat indicator to topright part of the frame. Maybe i should create an option to make it placeble everywhere. function UF:Update_CombatIndicator() local CombatText = ElvUF_Player.Combat if E.db.sle.combatico.pos == "NONE" then CombatText:ClearAllPoints() else local x, y = UF:GetPositionOffset(E.db.sle.combatico.pos) CombatText:ClearAllPoints() CombatText:Point(E.db.sle.combatico.pos, ElvUF_Player.Health, E.db.sle.combatico.pos, x, x) end SLE:UnregisterEvent("PLAYER_REGEN_DISABLED") end UF.Update_PlayerFrameSLE = UF.Update_PlayerFrame function UF:Update_PlayerFrame(frame, db) UF:Update_PlayerFrameSLE(frame, db) if not E.db.unitframe.units.player.classbar.offset then return end --Checking for offset option enabled frame.db = db if frame.Portrait then frame.Portrait:Hide() frame.Portrait:ClearAllPoints() frame.Portrait.backdrop:Hide() end frame.Portrait = db.portrait.style == '2D' and frame.Portrait2D or frame.Portrait3D frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp') local BORDER = E.Border local SPACING = E.Spacing local SHADOW_SPACING = E.PixelMode and 3 or 4 local UNIT_WIDTH = db.width local UNIT_HEIGHT = db.height local USE_POWERBAR = db.power.enable --local USE_MINI_POWERBAR = db.power.width ~= 'fill' and USE_POWERBAR local USE_INSET_POWERBAR = db.power.width == 'inset' and USE_POWERBAR local USE_MINI_POWERBAR = db.power.width == 'spaced' and USE_POWERBAR local USE_POWERBAR_OFFSET = db.power.offset ~= 0 and USE_POWERBAR local POWERBAR_OFFSET = db.power.offset local POWERBAR_HEIGHT = db.power.height local POWERBAR_WIDTH = db.width - (BORDER*2) local USE_CLASSBAR = db.classbar.enable and CAN_HAVE_CLASSBAR local USE_MINI_CLASSBAR = db.classbar.fill == "spaced" and USE_CLASSBAR local CLASSBAR_HEIGHT = db.classbar.height local CLASSBAR_WIDTH = db.width - (BORDER*2) local USE_PORTRAIT = db.portrait.enable local USE_PORTRAIT_OVERLAY = db.portrait.overlay and USE_PORTRAIT local PORTRAIT_WIDTH = db.portrait.width local unit = self.unit frame.colors = ElvUF.colors frame:Size(UNIT_WIDTH, UNIT_HEIGHT) _G[frame:GetName()..'Mover']:Size(frame:GetSize()) --[[ --Power Text if E.db.unitframe.units.player.fixTo == "power" then local x, y = self:GetPositionOffset(db.power.position) power.value:ClearAllPoints() power.value:Point(db.power.position, frame.Power, db.power.position, x, y) frame:Tag(power.value, db.power.text_format) end ]] --All this crap is needed to be copied from Elv's player.lua to avoid graphical bugs --Adjust some variables do if not USE_POWERBAR then POWERBAR_HEIGHT = 0 end if USE_PORTRAIT_OVERLAY or not USE_PORTRAIT then PORTRAIT_WIDTH = 0 end if USE_PORTRAIT then CLASSBAR_WIDTH = (UNIT_WIDTH - (BORDER*2)) - PORTRAIT_WIDTH end if USE_POWERBAR_OFFSET then CLASSBAR_WIDTH = CLASSBAR_WIDTH - POWERBAR_OFFSET end if USE_MINI_POWERBAR then POWERBAR_WIDTH = POWERBAR_WIDTH / 2 end end --End of needed copy. local mini_classbarY = 0 if USE_MINI_CLASSBAR then mini_classbarY = -(SPACING+(CLASSBAR_HEIGHT/2)) end --Threat do local threat = frame.Threat if db.threatStyle ~= 'NONE' and db.threatStyle ~= nil then if not frame:IsElementEnabled('Threat') then frame:EnableElement('Threat') end if db.threatStyle == "GLOW" then threat:SetFrameStrata('BACKGROUND') threat.glow:ClearAllPoints() threat.glow:SetBackdropBorderColor(0, 0, 0, 0) threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING+mini_classbarY) threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING+mini_classbarY) if USE_MINI_POWERBAR then threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) else threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING) end if USE_POWERBAR_OFFSET then threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING+mini_classbarY) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING) if USE_PORTRAIT == true and not USE_PORTRAIT_OVERLAY then threat.glow:Point("BOTTOMLEFT", frame.Portrait.backdrop, "BOTTOMLEFT", -4, -4) else threat.glow:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", -5, -5) end threat.glow:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", 5, -5) end elseif db.threatStyle == "ICONTOPLEFT" or db.threatStyle == "ICONTOPRIGHT" or db.threatStyle == "ICONBOTTOMLEFT" or db.threatStyle == "ICONBOTTOMRIGHT" or db.threatStyle == "ICONTOP" or db.threatStyle == "ICONBOTTOM" or db.threatStyle == "ICONLEFT" or db.threatStyle == "ICONRIGHT" then threat:SetFrameStrata('HIGH') local point = db.threatStyle point = point:gsub("ICON", "") threat.texIcon:ClearAllPoints() threat.texIcon:SetPoint(point, frame.Health, point) end elseif frame:IsElementEnabled('Threat') then frame:DisableElement('Threat') end end --Rest Icon do local rIcon = frame.Resting if db.restIcon then if not frame:IsElementEnabled('Resting') then frame:EnableElement('Resting') end elseif frame:IsElementEnabled('Resting') then frame:DisableElement('Resting') rIcon:Hide() end end --Health do local health = frame.Health health.Smooth = self.db.smoothbars --Text local x, y = self:GetPositionOffset(db.health.position) health.value:ClearAllPoints() health.value:Point(db.health.position, health, db.health.position, x + db.health.xOffset, y + db.health.yOffset) frame:Tag(health.value, db.health.text_format) --Colors health.colorSmooth = nil health.colorHealth = nil health.colorClass = nil health.colorReaction = nil if self.db['colors'].healthclass ~= true then if self.db['colors'].colorhealthbyvalue == true then health.colorSmooth = true else health.colorHealth = true end else health.colorClass = true health.colorReaction = true end --Position health:ClearAllPoints() health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER, -BORDER) if USE_POWERBAR_OFFSET then health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+POWERBAR_OFFSET), -BORDER) health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER+POWERBAR_OFFSET) elseif USE_INSET_POWERBAR then health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER) elseif USE_MINI_POWERBAR then health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER + (POWERBAR_HEIGHT/2)) else health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", BORDER, BORDER + POWERBAR_HEIGHT) end health.bg:ClearAllPoints() if not USE_PORTRAIT_OVERLAY then health:Point("TOPLEFT", PORTRAIT_WIDTH+BORDER, -BORDER) health.bg:SetParent(health) health.bg:SetAllPoints() else health.bg:Point('BOTTOMLEFT', health:GetStatusBarTexture(), 'BOTTOMRIGHT') health.bg:Point('TOPRIGHT', health) health.bg:SetParent(frame.Portrait.overlay) end if USE_CLASSBAR then local DEPTH if USE_MINI_CLASSBAR then DEPTH = -(BORDER) else DEPTH = -(BORDER+SPACING) --DEPTH = -(BORDER+CLASSBAR_HEIGHT+SPACING) end if USE_POWERBAR_OFFSET then health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+POWERBAR_OFFSET), DEPTH) else health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER, DEPTH) end health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH+BORDER, DEPTH) end end --Name UF:UpdateNameSettings(frame) --PvP do local pvp = frame.PvPText local x, y = self:GetPositionOffset(db.pvp.position) pvp:ClearAllPoints() pvp:Point(db.pvp.position, frame.Health, db.pvp.position, x, y) frame:Tag(pvp, db.pvp.text_format) end --Power do local power = frame.Power if USE_POWERBAR then if not frame:IsElementEnabled('Power') then frame:EnableElement('Power') if frame.DruidAltMana then frame:EnableElement('DruidAltMana') end power:Show() end power.Smooth = self.db.smoothbars --Text local x, y = self:GetPositionOffset(db.power.position) power.value:ClearAllPoints() power.value:Point(db.power.position, frame.Health, db.power.position, x + db.power.xOffset, y + db.power.yOffset) frame:Tag(power.value, db.power.text_format) --Colors power.colorClass = nil power.colorReaction = nil power.colorPower = nil if self.db['colors'].powerclass then power.colorClass = true power.colorReaction = true else power.colorPower = true end --Position power:ClearAllPoints() if USE_POWERBAR_OFFSET then power:Point("TOPRIGHT", frame.Health, "TOPRIGHT", POWERBAR_OFFSET, -POWERBAR_OFFSET) power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", POWERBAR_OFFSET, -POWERBAR_OFFSET) power:SetFrameStrata("LOW") power:SetFrameLevel(2) elseif USE_INSET_POWERBAR then power:Height(POWERBAR_HEIGHT - BORDER*2) power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", BORDER + (BORDER*2), BORDER + (BORDER*2)) power:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -(BORDER + (BORDER*2)), BORDER + (BORDER*2)) power:SetFrameStrata("MEDIUM") power:SetFrameLevel(frame:GetFrameLevel() + 3) elseif USE_MINI_POWERBAR then power:Width(POWERBAR_WIDTH - BORDER*2) power:Height(POWERBAR_HEIGHT - BORDER*2) power:Point("RIGHT", frame, "BOTTOMRIGHT", -(BORDER*2 + 4), BORDER + (POWERBAR_HEIGHT/2)) power:SetFrameStrata("MEDIUM") power:SetFrameLevel(frame:GetFrameLevel() + 3) else power:Point("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", BORDER, -(E.PixelMode and 0 or (BORDER + SPACING))) power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -BORDER, BORDER) end elseif frame:IsElementEnabled('Power') then frame:DisableElement('Power') power:Hide() if frame.DruidAltMana then frame:DisableElement('DruidAltMana') frame.DruidAltMana:Hide() end end end --Portrait do local portrait = frame.Portrait --Set Points if USE_PORTRAIT then if not frame:IsElementEnabled('Portrait') then frame:EnableElement('Portrait') end portrait:ClearAllPoints() if USE_PORTRAIT_OVERLAY then if db.portrait.style == '3D' then portrait:SetFrameLevel(frame.Health:GetFrameLevel() + 1) end portrait:SetAllPoints(frame.Health) portrait:SetAlpha(0.3) portrait:Show() portrait.backdrop:Hide() else portrait:SetAlpha(1) portrait:Show() portrait.backdrop:Show() if db.portrait.style == '3D' then portrait:SetFrameLevel(frame:GetFrameLevel() + 5) end if USE_MINI_CLASSBAR and USE_CLASSBAR then portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT", 0, -((CLASSBAR_HEIGHT/2))) else portrait.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT") end if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or not USE_POWERBAR or USE_INSET_POWERBAR then portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) else portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) end portrait:Point('BOTTOMLEFT', portrait.backdrop, 'BOTTOMLEFT', BORDER, BORDER) portrait:Point('TOPRIGHT', portrait.backdrop, 'TOPRIGHT', -BORDER, -BORDER) end else if frame:IsElementEnabled('Portrait') then frame:DisableElement('Portrait') portrait:Hide() portrait.backdrop:Hide() end end end --Auras Disable/Enable --Only do if both debuffs and buffs aren't being used. do if db.debuffs.enable or db.buffs.enable then if not frame:IsElementEnabled('Aura') then frame:EnableElement('Aura') end else if frame:IsElementEnabled('Aura') then frame:DisableElement('Aura') end end frame.Buffs:ClearAllPoints() frame.Debuffs:ClearAllPoints() end --Buffs do local buffs = frame.Buffs local rows = db.buffs.numrows if USE_POWERBAR_OFFSET then buffs:SetWidth(UNIT_WIDTH - POWERBAR_OFFSET) else buffs:SetWidth(UNIT_WIDTH) end buffs.forceShow = frame.forceShowAuras buffs.num = db.buffs.perrow * rows buffs.size = db.buffs.sizeOverride ~= 0 and db.buffs.sizeOverride or ((((buffs:GetWidth() - (buffs.spacing*(buffs.num/rows - 1))) / buffs.num)) * rows) if db.buffs.sizeOverride and db.buffs.sizeOverride > 0 then buffs:SetWidth(db.buffs.perrow * db.buffs.sizeOverride) end local x, y = E:GetXYOffset(db.buffs.anchorPoint) local attachTo = self:GetAuraAnchorFrame(frame, db.buffs.attachTo) buffs:Point(E.InversePoints[db.buffs.anchorPoint], attachTo, db.buffs.anchorPoint, x + db.buffs.xOffset, y + db.buffs.yOffset + (E.PixelMode and (db.buffs.anchorPoint:find('TOP') and -1 or 1) or 0)) buffs:Height(buffs.size * rows) buffs["growth-y"] = db.buffs.anchorPoint:find('TOP') and 'UP' or 'DOWN' buffs["growth-x"] = db.buffs.anchorPoint == 'LEFT' and 'LEFT' or db.buffs.anchorPoint == 'RIGHT' and 'RIGHT' or (db.buffs.anchorPoint:find('LEFT') and 'RIGHT' or 'LEFT') buffs.initialAnchor = E.InversePoints[db.buffs.anchorPoint] if db.buffs.enable then buffs:Show() else buffs:Hide() end end --Debuffs do local debuffs = frame.Debuffs local rows = db.debuffs.numrows if USE_POWERBAR_OFFSET then debuffs:SetWidth(UNIT_WIDTH - POWERBAR_OFFSET) else debuffs:SetWidth(UNIT_WIDTH) end debuffs.forceShow = frame.forceShowAuras debuffs.num = db.debuffs.perrow * rows debuffs.size = db.debuffs.sizeOverride ~= 0 and db.debuffs.sizeOverride or ((((debuffs:GetWidth() - (debuffs.spacing*(debuffs.num/rows - 1))) / debuffs.num)) * rows) if db.debuffs.sizeOverride and db.debuffs.sizeOverride > 0 then debuffs:SetWidth(db.debuffs.perrow * db.debuffs.sizeOverride) end local x, y = E:GetXYOffset(db.debuffs.anchorPoint) local attachTo = self:GetAuraAnchorFrame(frame, db.debuffs.attachTo, db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS') debuffs:Point(E.InversePoints[db.debuffs.anchorPoint], attachTo, db.debuffs.anchorPoint, x + db.debuffs.xOffset, y + db.debuffs.yOffset) debuffs:Height(debuffs.size * rows) debuffs["growth-y"] = db.debuffs.anchorPoint:find('TOP') and 'UP' or 'DOWN' debuffs["growth-x"] = db.debuffs.anchorPoint == 'LEFT' and 'LEFT' or db.debuffs.anchorPoint == 'RIGHT' and 'RIGHT' or (db.debuffs.anchorPoint:find('LEFT') and 'RIGHT' or 'LEFT') debuffs.initialAnchor = E.InversePoints[db.debuffs.anchorPoint] if db.debuffs.enable then debuffs:Show() else debuffs:Hide() end end --Castbar do local castbar = frame.Castbar castbar:Width(db.castbar.width - (E.PixelMode and 2 or (BORDER * 2))) castbar:Height(db.castbar.height) castbar.Holder:Width(db.castbar.width + (E.PixelMode and 0 or (BORDER * 2))) castbar.Holder:Height(db.castbar.height + (E.PixelMode and 2 or (BORDER * 2))) castbar.Holder:GetScript('OnSizeChanged')(castbar.Holder) --Latency if db.castbar.latency then castbar.SafeZone = castbar.LatencyTexture castbar.LatencyTexture:Show() else castbar.SafeZone = nil castbar.LatencyTexture:Hide() end --Icon if db.castbar.icon then castbar.Icon = castbar.ButtonIcon castbar.Icon.bg:Width(db.castbar.height + (E.Border * 2)) castbar.Icon.bg:Height(db.castbar.height + (E.Border * 2)) castbar:Width(db.castbar.width - castbar.Icon.bg:GetWidth() - (E.PixelMode and 1 or 5)) castbar.Icon.bg:Show() else castbar.ButtonIcon.bg:Hide() castbar.Icon = nil end if db.castbar.spark then castbar.Spark:Show() else castbar.Spark:Hide() end if db.castbar.enable and not frame:IsElementEnabled('Castbar') then frame:EnableElement('Castbar') elseif not db.castbar.enable and frame:IsElementEnabled('Castbar') then frame:DisableElement('Castbar') end end do --Classbars if E.myclass == "PALADIN" then local bars = frame.HolyPower frame.ClassBar = bars bars:ClearAllPoints() local MAX_HOLY_POWER = 5 if USE_MINI_CLASSBAR then CLASSBAR_WIDTH = CLASSBAR_WIDTH * (MAX_HOLY_POWER - 1) / MAX_HOLY_POWER bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 6), (db.classbar.yOffset or 0)) bars:SetFrameStrata("MEDIUM") else bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) + BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING))) bars:SetFrameStrata("LOW") end bars:Width(CLASSBAR_WIDTH) bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4)) for i = 1, MAX_HOLY_POWER do bars[i]:SetHeight(bars:GetHeight()) bars[i]:SetWidth(E:Scale(bars:GetWidth() - (E.PixelMode and 4 or 2))/MAX_HOLY_POWER) bars[i]:GetStatusBarTexture():SetHorizTile(false) bars[i]:ClearAllPoints() if i == 1 then bars[i]:SetPoint("LEFT", bars) else if USE_MINI_CLASSBAR then bars[i]:Point("LEFT", bars[i-1], "RIGHT", SPACING+(BORDER*2)+2, 0) else bars[i]:Point("LEFT", bars[i-1], "RIGHT", 1, 0) end end if not USE_MINI_CLASSBAR then bars[i].backdrop:Hide() else bars[i].backdrop:Show() end bars[i]:SetStatusBarColor(unpack(ElvUF.colors.holyPower)) end if not USE_MINI_CLASSBAR then bars.backdrop:Show() else bars.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('HolyPower') then frame:EnableElement('HolyPower') bars:Show() elseif not USE_CLASSBAR and frame:IsElementEnabled('HolyPower') then frame:DisableElement('HolyPower') bars:Hide() end elseif E.myclass == 'PRIEST' then local bars = frame.ShadowOrbs frame.ClassBar = bars bars:ClearAllPoints() if USE_MINI_CLASSBAR then CLASSBAR_WIDTH = CLASSBAR_WIDTH * (PRIEST_BAR_NUM_ORBS - 1) / PRIEST_BAR_NUM_ORBS bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 6), (db.classbar.yOffset or 0)) bars:SetFrameStrata("MEDIUM") else bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING))) bars:SetFrameStrata("LOW") end bars:Width(CLASSBAR_WIDTH) bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4)) for i = 1, PRIEST_BAR_NUM_ORBS do bars[i]:SetHeight(bars:GetHeight()) bars[i]:SetWidth((bars:GetWidth() - 2)/PRIEST_BAR_NUM_ORBS) bars[i]:GetStatusBarTexture():SetHorizTile(false) bars[i]:ClearAllPoints() if i == 1 then bars[i]:SetPoint("LEFT", bars) else if USE_MINI_CLASSBAR then bars[i]:Point("LEFT", bars[i-1], "RIGHT", SPACING+(BORDER*2)+8, 0) else bars[i]:Point("LEFT", bars[i-1], "RIGHT", 1, 0) end end if not USE_MINI_CLASSBAR then bars[i].backdrop:Hide() else bars[i].backdrop:Show() end bars[i]:SetStatusBarColor(unpack(ElvUF.colors.shadowOrbs)) end if not USE_MINI_CLASSBAR then bars.backdrop:Show() else bars.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('ShadowOrbs') then frame:EnableElement('ShadowOrbs') elseif not USE_CLASSBAR and frame:IsElementEnabled('ShadowOrbs') then frame:DisableElement('ShadowOrbs') bars:Hide() end elseif E.myclass == 'MAGE' then local bars = frame.ArcaneChargeBar frame.ClassBar = bars bars:ClearAllPoints() if USE_MINI_CLASSBAR then CLASSBAR_WIDTH = CLASSBAR_WIDTH * (UF['classMaxResourceBar'][E.myclass] - 1) / UF['classMaxResourceBar'][E.myclass] bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 12), (db.classbar.yOffset or 0)) bars:SetFrameStrata("MEDIUM") else bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING))) bars:SetFrameStrata("LOW") end bars:Width(CLASSBAR_WIDTH) bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4)) local maxBars = UF['classMaxResourceBar'][E.myclass] for i = 1, maxBars do bars[i]:SetHeight(bars:GetHeight()) bars[i]:SetWidth((bars:GetWidth() - (maxBars - 1)) / maxBars) bars[i]:GetStatusBarTexture():SetHorizTile(false) bars[i]:ClearAllPoints() if i == 1 then bars[i]:SetPoint("LEFT", bars) else if USE_MINI_CLASSBAR then bars[i]:Point("LEFT", bars[i-1], "RIGHT", SPACING+(BORDER*2)+2, 0) else bars[i]:Point("LEFT", bars[i-1], "RIGHT", 1, 0) end end bars[i]:SetStatusBarColor(unpack(ElvUF.colors.arcaneCharges)) bars[i].bg:SetTexture(unpack(ElvUF.colors.arcaneCharges)) if not USE_MINI_CLASSBAR then bars[i].backdrop:Hide() else bars[i].backdrop:Show() end end if not USE_MINI_CLASSBAR then bars.backdrop:Show() else bars.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('ArcaneChargeBar') then frame:EnableElement('ArcaneChargeBar') elseif not USE_CLASSBAR and frame:IsElementEnabled('ArcaneChargeBar') then frame:DisableElement('ArcaneChargeBar') end elseif E.myclass == "WARLOCK" then local bars = frame.ShardBar frame.ClassBar = bars bars:ClearAllPoints() if USE_MINI_CLASSBAR then CLASSBAR_WIDTH = CLASSBAR_WIDTH * 2 / 3 bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 6), (db.classbar.yOffset or 0)) bars:SetFrameStrata("MEDIUM") else bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) + (E.PixelMode and 0 or (BORDER + SPACING))) bars:SetFrameStrata("LOW") end bars:Width(CLASSBAR_WIDTH) bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4)) if not USE_MINI_CLASSBAR then bars.backdrop:Show() else bars.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('ShardBar') then frame:EnableElement('ShardBar') elseif not USE_CLASSBAR and frame:IsElementEnabled('ShardBar') then frame:DisableElement('ShardBar') bars:Hide() end elseif E.myclass == 'MONK' then local bars = frame.Harmony frame.ClassBar = bars bars:ClearAllPoints() if USE_MINI_CLASSBAR then bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 6), (db.classbar.yOffset or 0)) bars:SetFrameStrata("MEDIUM") else --bars:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0)) bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING)) ) bars:SetFrameStrata("MEDIUM") end bars:Width(CLASSBAR_WIDTH) bars:Height(CLASSBAR_HEIGHT - (E.PixelMode and 1 or 4)) if not USE_MINI_CLASSBAR then bars.backdrop:Show() else bars.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('Harmony') then frame:EnableElement('Harmony') bars:Show() elseif not USE_CLASSBAR and frame:IsElementEnabled('Harmony') then frame:DisableElement('Harmony') bars:Hide() end elseif E.myclass == "DEATHKNIGHT" then local runes = frame.Runes frame.ClassBar = runes runes:ClearAllPoints() if USE_MINI_CLASSBAR then CLASSBAR_WIDTH = CLASSBAR_WIDTH * 4/5 runes:Point("CENTER", frame.Health.backdrop, "TOP", (db.classbar.xOffset or 0) -(BORDER*3 + 8), (db.classbar.yOffset or 0)) runes:SetFrameStrata("MEDIUM") else runes:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING))) runes:SetFrameStrata("LOW") end runes:Width(CLASSBAR_WIDTH) runes:Height(CLASSBAR_HEIGHT - (BORDER*2)) for i = 1, 6 do runes[i]:SetHeight(runes:GetHeight()) runes[i]:SetWidth(E:Scale(runes:GetWidth() - 5) / 6) if USE_MINI_CLASSBAR then runes[i].backdrop:Show() else runes[i].backdrop:Hide() end runes[i]:ClearAllPoints() if i == 1 then runes[i]:SetPoint("LEFT", runes) else if USE_MINI_CLASSBAR then runes[i]:Point("LEFT", runes[i-1], "RIGHT", 1+(BORDER*2)+2, 0) else runes[i]:Point("LEFT", runes[i-1], "RIGHT", 1, 0) end end if not USE_MINI_CLASSBAR then runes[i].backdrop:Hide() else runes[i].backdrop:Show() end end if not USE_MINI_CLASSBAR then runes.backdrop:Show() else runes.backdrop:Hide() end if USE_CLASSBAR and not frame:IsElementEnabled('Runes') then frame:EnableElement('Runes') runes:Show() elseif not USE_CLASSBAR and frame:IsElementEnabled('Runes') then frame:DisableElement('Runes') runes:Hide() RuneFrame.Show = RuneFrame.Hide RuneFrame:Hide() end if runes.UpdateAllRuneTypes then runes.UpdateAllRuneTypes(frame) --colors update end elseif E.myclass == "DRUID" then local eclipseBar = frame.EclipseBar frame.ClassBar = eclipseBar eclipseBar:ClearAllPoints() if not USE_MINI_CLASSBAR then eclipseBar:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +BORDER, (db.classbar.yOffset or 0) +(E.PixelMode and 0 or (BORDER + SPACING))) eclipseBar:SetFrameStrata("LOW") else CLASSBAR_WIDTH = CLASSBAR_WIDTH * 2/3 eclipseBar:Point("LEFT", frame.Health.backdrop, "TOPLEFT", (db.classbar.xOffset or 0) +(BORDER*2 + 4), (db.classbar.yOffset or 0)) eclipseBar:SetFrameStrata("MEDIUM") end eclipseBar:Width(CLASSBAR_WIDTH) eclipseBar:Height(CLASSBAR_HEIGHT - (BORDER*2)) --?? Apparent bug fix for the width after in-game settings change eclipseBar.LunarBar:SetMinMaxValues(0, 0) eclipseBar.SolarBar:SetMinMaxValues(0, 0) eclipseBar.LunarBar:SetStatusBarColor(unpack(ElvUF.colors.eclipseBar[1])) eclipseBar.SolarBar:SetStatusBarColor(unpack(ElvUF.colors.eclipseBar[2])) eclipseBar.LunarBar:Size(CLASSBAR_WIDTH, CLASSBAR_HEIGHT - (BORDER*2)) eclipseBar.SolarBar:Size(CLASSBAR_WIDTH, CLASSBAR_HEIGHT - (BORDER*2)) if USE_CLASSBAR and not frame:IsElementEnabled('EclipseBar') then frame:EnableElement('EclipseBar') eclipseBar:Show() elseif not USE_CLASSBAR and frame:IsElementEnabled('EclipseBar') then frame:DisableElement('EclipseBar') eclipseBar:Hide() end end end --Stagger do if E.myclass == "MONK" then local stagger = frame.Stagger if db.stagger.enable then if not frame:IsElementEnabled('Stagger') then frame:EnableElement('Stagger') end else if frame:IsElementEnabled('Stagger') then frame:DisableElement('Stagger') end end end end --Combat Fade do if db.combatfade and not frame:IsElementEnabled('CombatFade') then frame:EnableElement('CombatFade') elseif not db.combatfade and frame:IsElementEnabled('CombatFade') then frame:DisableElement('CombatFade') end end --Debuff Highlight do local dbh = frame.DebuffHighlight if E.db.unitframe.debuffHighlighting then frame:EnableElement('DebuffHighlight') else frame:DisableElement('DebuffHighlight') end end --Raid Icon do local RI = frame.RaidIcon if db.raidicon.enable then frame:EnableElement('RaidIcon') RI:Show() RI:Size(db.raidicon.size) local x, y = self:GetPositionOffset(db.raidicon.attachTo) RI:ClearAllPoints() RI:Point(db.raidicon.attachTo, frame, db.raidicon.attachTo, x + db.raidicon.xOffset, y + db.raidicon.yOffset) else frame:DisableElement('RaidIcon') RI:Hide() end end --OverHealing do local healPrediction = frame.HealPrediction local c = UF.db.colors.healPrediction if db.healPrediction then if not frame:IsElementEnabled('HealPrediction') then frame:EnableElement('HealPrediction') end if not USE_PORTRAIT_OVERLAY then healPrediction.myBar:SetParent(frame) healPrediction.otherBar:SetParent(frame) healPrediction.absorbBar:SetParent(frame) else healPrediction.myBar:SetParent(frame.Portrait.overlay) healPrediction.otherBar:SetParent(frame.Portrait.overlay) healPrediction.absorbBar:SetParent(frame.Portrait.overlay) end healPrediction.myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a) healPrediction.otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.a) healPrediction.absorbBar:SetStatusBarColor(c.absorbs.r, c.absorbs.g, c.absorbs.b, c.absorbs.a) else if frame:IsElementEnabled('HealPrediction') then frame:DisableElement('HealPrediction') end end end --AuraBars do local auraBars = frame.AuraBars if db.aurabar.enable then if not frame:IsElementEnabled('AuraBars') then frame:EnableElement('AuraBars') end auraBars:Show() auraBars.friendlyAuraType = db.aurabar.friendlyAuraType auraBars.enemyAuraType = db.aurabar.enemyAuraType local buffColor = UF.db.colors.auraBarBuff local debuffColor = UF.db.colors.auraBarDebuff local attachTo = frame if db.aurabar.attachTo == 'BUFFS' then attachTo = frame.Buffs elseif db.aurabar.attachTo == 'DEBUFFS' then attachTo = frame.Debuffs end local anchorPoint, anchorTo = 'BOTTOM', 'TOP' if db.aurabar.anchorPoint == 'BELOW' then anchorPoint, anchorTo = 'TOP', 'BOTTOM' end local yOffset = 0; if E.PixelMode then if db.aurabar.anchorPoint == 'BELOW' then yOffset = 1; else yOffset = -1; end end auraBars.auraBarHeight = db.aurabar.height auraBars:ClearAllPoints() auraBars:SetPoint(anchorPoint..'LEFT', attachTo, anchorTo..'LEFT', (attachTo == frame and anchorTo == 'BOTTOM') and POWERBAR_OFFSET or 0, E.PixelMode and anchorPoint == -1 or yOffset) auraBars:SetPoint(anchorPoint..'RIGHT', attachTo, anchorTo..'RIGHT', attachTo == frame and POWERBAR_OFFSET * (anchorTo == 'BOTTOM' and 0 or -1) or 0, E.PixelMode and -1 or yOffset) auraBars.buffColor = {buffColor.r, buffColor.g, buffColor.b} if UF.db.colors.auraBarByType then auraBars.debuffColor = nil; auraBars.defaultDebuffColor = {debuffColor.r, debuffColor.g, debuffColor.b} else auraBars.debuffColor = {debuffColor.r, debuffColor.g, debuffColor.b} auraBars.defaultDebuffColor = nil; end auraBars.down = db.aurabar.anchorPoint == 'BELOW' if db.aurabar.sort == 'TIME_REMAINING' then auraBars.sort = true --default function elseif db.aurabar.sort == 'TIME_REMAINING_REVERSE' then auraBars.sort = UF.SortAuraBarReverse elseif db.aurabar.sort == 'TIME_DURATION' then auraBars.sort = UF.SortAuraBarDuration elseif db.aurabar.sort == 'TIME_DURATION_REVERSE' then auraBars.sort = UF.SortAuraBarDurationReverse elseif db.aurabar.sort == 'NAME' then auraBars.sort = UF.SortAuraBarName else auraBars.sort = nil end auraBars:SetAnchors() else if frame:IsElementEnabled('AuraBars') then frame:DisableElement('AuraBars') auraBars:Hide() end end end if db.customTexts then local customFont = UF.LSM:Fetch("font", UF.db.font) for objectName, _ in pairs(db.customTexts) do if not frame[objectName] then frame[objectName] = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY') end local objectDB = db.customTexts[objectName] if objectDB.font then customFont = UF.LSM:Fetch("font", objectDB.font) end frame[objectName]:FontTemplate(customFont, objectDB.size or UF.db.fontSize, objectDB.fontOutline or UF.db.fontOutline) frame:Tag(frame[objectName], objectDB.text_format or '') frame[objectName]:SetJustifyH(objectDB.justifyH or 'CENTER') frame[objectName]:ClearAllPoints() frame[objectName]:SetPoint(objectDB.justifyH or 'CENTER', frame, 'CENTER', objectDB.xOffset, objectDB.yOffset) end end if UF.db.colors.transparentHealth then UF:ToggleTransparentStatusBar(true, frame.Health, frame.Health.bg) else UF:ToggleTransparentStatusBar(false, frame.Health, frame.Health.bg, (USE_PORTRAIT and USE_PORTRAIT_OVERLAY) ~= true) end if UF.db.colors.transparentPower then UF:ToggleTransparentStatusBar(true, frame.Power, frame.Power.bg) else UF:ToggleTransparentStatusBar(false, frame.Power, frame.Power.bg, true) end E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + db.castbar.height)) frame:UpdateAllElements() end UF.UpdatePlayerFrameAnchorsSLE = UF.UpdatePlayerFrameAnchors function UF:UpdatePlayerFrameAnchors(frame, isShown) UF:UpdatePlayerFrameAnchorsSLE(frame, isShown) if E.db.sle == nil then E.db.sle = {} end local db = E.db['unitframe']['units'].player local health = frame.Health local threat = frame.Threat local power = frame.Power local stagger = frame.Stagger local PORTRAIT_WIDTH = db.portrait.width local USE_PORTRAIT = db.portrait.enable local USE_PORTRAIT_OVERLAY = db.portrait.overlay and USE_PORTRAIT local CLASSBAR_HEIGHT = db.classbar.height local USE_CLASSBAR = db.classbar.enable local USE_MINI_CLASSBAR = db.classbar.fill == "spaced" and USE_CLASSBAR local USE_POWERBAR = db.power.enable local USE_INSET_POWERBAR = db.power.width == 'inset' and USE_POWERBAR local USE_MINI_POWERBAR = db.power.width == 'spaced' and USE_POWERBAR local USE_POWERBAR_OFFSET = db.power.offset ~= 0 and USE_POWERBAR local POWERBAR_OFFSET = db.power.offset local POWERBAR_HEIGHT = db.power.height local SPACING = E.Spacing; local BORDER = E.Border; local SHADOW_SPACING = E.PixelMode and 3 or 4 local USE_STAGGER = stagger and stagger:IsShown(); local STAGGER_WIDTH = USE_STAGGER and (db.stagger.width + (BORDER*2)) or 0; --[[ if E.db.unitframe.units.player.classbar.offset then local DEPTH if USE_MINI_CLASSBAR then DEPTH = -(E:Scale(2)+(CLASSBAR_HEIGHT/2)) else DEPTH = -(E:Scale(2)) end if not USE_MINI_CLASSBAR and (USE_PORTRAIT and not USE_PORTRAIT_OVERLAY) then health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH + 2, DEPTH) end end]] if E.db.unitframe.units.player.classbar.offset then if not USE_POWERBAR then POWERBAR_HEIGHT = 0 end if USE_PORTRAIT_OVERLAY or not USE_PORTRAIT then PORTRAIT_WIDTH = 0 end if USE_MINI_CLASSBAR then CLASSBAR_HEIGHT = CLASSBAR_HEIGHT / 2 end if isShown then if db.power.offset ~= 0 then health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER+db.power.offset) - STAGGER_WIDTH, -(BORDER + SPACING)) else health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER - STAGGER_WIDTH, -(BORDER + SPACING)) end health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH + BORDER, -(BORDER + SPACING)) local mini_classbarY = 0 if USE_MINI_CLASSBAR then mini_classbarY = -(SPACING+(CLASSBAR_HEIGHT)) end if db.threatStyle == "GLOW" then threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING+mini_classbarY) threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING+mini_classbarY) if USE_MINI_POWERBAR then threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) else threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING) end if USE_POWERBAR_OFFSET then threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING+mini_classbarY) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING) end end if db.portrait.enable and not USE_PORTRAIT_OVERLAY then local portrait = frame.Portrait portrait.backdrop:ClearAllPoints() if USE_MINI_CLASSBAR and USE_CLASSBAR then portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT", 0, -(CLASSBAR_HEIGHT + SPACING)) else portrait.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT") end if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or USE_INSET_POWERBAR or not USE_POWERBAR or USE_INSET_POWERBAR then portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) else portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) end end else if db.power.offset ~= 0 then health:Point("TOPRIGHT", frame, "TOPRIGHT", -(BORDER + db.power.offset) - STAGGER_WIDTH, -BORDER) else health:Point("TOPRIGHT", frame, "TOPRIGHT", -BORDER - STAGGER_WIDTH, -BORDER) end health:Point("TOPLEFT", frame, "TOPLEFT", PORTRAIT_WIDTH + BORDER, -BORDER) if db.threatStyle == "GLOW" then threat.glow:Point("TOPLEFT", -SHADOW_SPACING, SHADOW_SPACING) threat.glow:Point("TOPRIGHT", SHADOW_SPACING, SHADOW_SPACING) if USE_MINI_POWERBAR then threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING + (POWERBAR_HEIGHT/2)) else threat.glow:Point("BOTTOMLEFT", -SHADOW_SPACING, -SHADOW_SPACING) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING, -SHADOW_SPACING) end if USE_POWERBAR_OFFSET then threat.glow:Point("TOPRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, SHADOW_SPACING) threat.glow:Point("BOTTOMRIGHT", SHADOW_SPACING-POWERBAR_OFFSET, -SHADOW_SPACING) end end if db.portrait.enable and not USE_PORTRAIT_OVERLAY and frame.Portrait then local portrait = frame.Portrait portrait.backdrop:ClearAllPoints() portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT") if USE_MINI_POWERBAR or USE_POWERBAR_OFFSET or not USE_POWERBAR or USE_INSET_POWERBAR then portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) else portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", E.PixelMode and 1 or -SPACING, 0) end end end end if E.myclass == "DRUID" then UF:EclipseTextSLE() end if E.myclass == "WARLOCK" then UF:DFTextSLE() end end function UF:ClassbarTextSLE() if E.myclass == "DRUID" then UF:EclipseTextSLE() elseif E.myclass == "WARLOCK" then UF:DFTextSLE() end end function UF:EclipseTextSLE() local eclipseBar = ElvUF_Player.EclipseBar local spower = UnitPower( PlayerFrame.unit, SPELL_POWER_ECLIPSE ); if E.db.sle.powtext then eclipseBar.powtext:SetText(spower) else eclipseBar.powtext:SetText('') end end function UF:DFTextSLE() local ShardBar = ElvUF_Player.ShardBar local dfpower = UnitPower( PlayerFrame.unit, SPELL_POWER_DEMONIC_FURY ); local hasspec = GetSpecialization(false, false) if hasspec == nil then return end local index = select(1, GetSpecializationInfo(GetSpecialization(false, false, active)), false, false) if index == 266 then --This crap is checking the spec. if E.db.sle.powtext then ShardBar.powtext:SetText(dfpower) if E.db.unitframe.units.player.classbar.fill == "spaced" then ShardBar.powtext:ClearAllPoints() ShardBar.powtext:SetPoint("LEFT", ShardBar, "RIGHT") else ShardBar.powtext:ClearAllPoints() ShardBar.powtext:SetPoint("CENTER", ShardBar, "CENTER") end else ShardBar.powtext:SetText('') end else ShardBar.powtext:SetText('') end end --Text for druid eclipse bar if E.myclass == "DRUID" then local eclipseBar = ElvUF_Player.EclipseBar local lunarBar = eclipseBar.LunarBar eclipseBar.powtext = lunarBar:CreateFontString(nil, 'OVERLAY') eclipseBar.powtext:SetPoint("CENTER", eclipseBar, "CENTER") eclipseBar.powtext:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE") end if E.myclass == "WARLOCK" then local ShardBar = ElvUF_Player.ShardBar local dfbar = select(2, ShardBar:GetChildren()) ShardBar.powtext = dfbar:CreateFontString(nil, 'OVERLAY') ShardBar.powtext:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE") end