PHP код:
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local OnEnter = function(self)
if (not C["Raid"]["MouseOverHighlight"].Value) then
return
end
if self.Health.colorClass then
self.Health:SetStatusBarColor(0.5, 0.5, 0.5)
else
local Class = select(2, UnitClass(self.unit))
if (not Class) then
return
end
local Color = RAID_CLASS_COLORS[Class]
self.Health:SetStatusBarColor(Color.r, Color.g, Color.b)
end
end
local OnLeave = function(self)
if (not C["Raid"]["MouseOverHighlight"].Value) then
return
end
if self.Health.colorClass then
local Class = select(2, UnitClass(self.unit))
if (not Class) then
return
end
local Color = RAID_CLASS_COLORS[Class]
self.Health:SetStatusBarColor(Color.r, Color.g, Color.b)
else
self.Health:SetStatusBarColor(UI:GetTableColors(C["General"]["TextureColor"].Value))
end
end
function UnitFrames:StyleRaid(self, unit)
-- General
self:RegisterForClicks("AnyUp")
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self:SetBackdrop(UnitFrames.Backdrop)
self:SetBackdropColor(0, 0, 0)
self:HookScript("OnEnter", OnEnter)
self:HookScript("OnLeave", OnLeave)
-- Health Bar
local Health = CreateFrame("StatusBar", nil, self)
Health:SetPoint("TOPLEFT", 0, 0)
if C["Raid"]["ShowPowerBars"].Value then
Health:SetPoint("BOTTOMRIGHT", 0, 6)
else
Health:SetPoint("BOTTOMRIGHT", 0, 0)
end
Health:SetOrientation(C["Raid"]["HealthOrientation"].Value)
Health:SetStatusBarTexture(Media:GetTexture(C["Raid"]["Texture"].Value))
local HealthBG = Health:CreateTexture(nil, "BORDER")
HealthBG:SetPoint("TOPLEFT", Health, 0, 0)
HealthBG:SetPoint("BOTTOMRIGHT", Health, 0, 0)
HealthBG:SetTexture("Interface\\Buttons\\WHITE8x8")
-- local HealthInnerBackdrop = Health:CreateTexture(nil, "BORDER")
-- HealthInnerBackdrop:SetPoint("TOPLEFT", Health, 0, 0)
-- HealthInnerBackdrop:SetPoint("BOTTOMRIGHT", Health, 0, 0)
-- HealthInnerBackdrop:SetTexture(Media:GetTexture(C["Raid"]["Texture"].Value))
-- HealthInnerBackdrop:SetVertexColor(UI:GetTableColors(C["Raid"]["HealthBackdropColor"].Value))
Health.Value = Health:CreateFontString(nil, "OVERLAY")
Health.Value:SetFont(Media:GetFont(C["Raid"]["Font"].Value), C["Raid"]["Size"].Value, C["Raid"]["Flags"].Value)
Health.Value:SetPoint("CENTER", Health, 1, -1)
Health.Value:SetShadowColor(0, 0, 0)
Health.Value:SetShadowOffset(1.25, -1.25)
-- Attributes
Health.frequentUpdates = true
Health.Smooth = C["Raid"]["SmoothBars"].Value
if C["Raid"]["DarkTheme"].Value then
Health.colorTapping = false
Health.colorDisconnected = false
Health.colorClass = false
Health:SetStatusBarColor(UI:GetTableColors(C["General"]["TextureColor"].Value))
else
Health.colorTapping = true
Health.colorDisconnected = true
Health.colorClass = true
Health.colorReaction = true
HealthBG.multiplier = 0.3
end
-- Handles
self.Health = Health
self.Health.bg = HealthBG
self.Health.BackdropTex = HealthInnerBackdrop
-- Power Bar
local Power = CreateFrame("StatusBar", nil, self)
Power:SetHeight(5)
Power:SetPoint("TOPLEFT", Health, "BOTTOMLEFT", 0, -1)
Power:SetPoint("TOPRIGHT", Health, "BOTTOMRIGHT", 0, -1)
Power:SetStatusBarTexture(C["Raid"]["Texture"].Value)
if (not C["Raid"]["ShowPowerBars"].Value) then
self:DisableElement("Power")
Power:Hide()
end
local PowerBG = Power:CreateTexture(nil, "BORDER")
PowerBG:SetPoint("TOPLEFT", Power, 0, 0)
PowerBG:SetPoint("BOTTOMRIGHT", Power, 0, 0)
PowerBG:SetTexture("Interface\\Buttons\\WHITE8x8")
-- Attributes
Power.frequentUpdates = true
Power.Smooth = C["Raid"]["SmoothBars"].Value
if C["Raid"]["DarkTheme"].Value then
Power.colorTapping = true
Power.colorClass = true
else
Power.colorPower = true
PowerBG.multiplier = 0.3
end
-- Handles
self.Power = Power
self.Power.bg = PowerBG
-- Name
local Name = Health:CreateFontString(nil, "OVERLAY")
Name:SetPoint("BOTTOM", Health, 1, 0)
Name:SetFont(Media:GetFont(C["Raid"]["Font"].Value), C["Raid"]["Size"].Value, C["Raid"]["Flags"].Value)
Name:SetShadowColor(0, 0, 0)
Name:SetShadowOffset(1.25, -1.25)
-- Tags
self:Tag(Health.Value, C["Raid"]["HealthTag"].Value)
self:Tag(Name, C["Raid"]["ExtraTag"].Value)
-- Handle
self.Name = Name
-- Plugins
-- Raid Icons
local RaidIcon = Health:CreateTexture(nil, "OVERLAY")
RaidIcon:SetSize(14, 14)
RaidIcon:SetPoint("TOP", 1, -1)
self.RaidIcon = RaidIcon
-- Leader Icon
local Leader = Health:CreateTexture(nil, "OVERLAY")
Leader:SetSize(14, 14)
Leader:SetPoint("TOPLEFT", 2, 8)
self.Leader = Leader
-- Master Looter
local MasterLooter = Health:CreateTexture(nil, "OVERLAY")
MasterLooter:SetSize(14, 14)
MasterLooter:SetPoint("TOPLEFT", 16, 8)
self.MasterLooter = MasterLooter
-- Role
local LFDRole = Health:CreateTexture(nil, "OVERLAY")
LFDRole:SetSize(14, 14)
LFDRole:SetPoint("TOP", 1, -1)
self.LFDRole = LFDRole
-- Range
self.Range = {
insideAlpha = C["Raid"]["InRangeAlpha"].Value,
outsideAlpha = C["Raid"]["OutOfRangeAlpha"].Value,
}
-- AuraWatch
--UnitFrames:CreateAuraWatch(self)
-- Debuff Watch
-- local RaidDebuffs = CreateFrame("Frame", nil, self)
-- RaidDebuffs:SetHeight(24)
-- RaidDebuffs:SetWidth(24)
-- RaidDebuffs:SetPoint("CENTER", Health, 1, 0)
-- RaidDebuffs:SetFrameStrata(Health:GetFrameStrata())
-- RaidDebuffs:SetFrameLevel(Health:GetFrameLevel() + 2)
-- RaidDebuffs:StyleFrame()
-- RaidDebuffs.icon = RaidDebuffs:CreateTexture(nil, "OVERLAY")
-- RaidDebuffs.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
-- RaidDebuffs.icon:SetPoint("TOPLEFT", 1, -1)
-- RaidDebuffs.icon:SetPoint("BOTTOMRIGHT", -1, 1)
-- RaidDebuffs.count = RaidDebuffs:CreateFontString(nil, "OVERLAY")
-- RaidDebuffs.count:SetFont(C["Media"]["Fonts"].Font, 10, "OUTLINE")
-- RaidDebuffs.count:SetPoint("BOTTOMRIGHT", RaidDebuffs, "BOTTOMRIGHT", 0, 2)
-- RaidDebuffs.count:SetTextColor(1, 0.9, 0)
-- RaidDebuffs.time = RaidDebuffs:CreateFontString(nil, "OVERLAY")
-- RaidDebuffs.time:SetFont(C["Media"]["Fonts"].Font, 10, "OUTLINE")
-- RaidDebuffs.time:SetPoint("CENTER")
-- RaidDebuffs.time:SetTextColor(1, 0.9, 0)
-- RaidDebuffs.bg = RaidDebuffs:CreateTexture(nil, "BORDER")
-- RaidDebuffs.bg:Point("TOPLEFT", RaidDebuffs, -1, 1)
-- RaidDebuffs.bg:Point("BOTTOMRIGHT", RaidDebuffs, 1, -1)
-- RaidDebuffs.bg:SetTexture(0, 0, 0)
-- self.RaidDebuffs = RaidDebuffs
-- Threat
local Threat = CreateFrame("Frame", nil, self)
Threat:SetPoint("TOPLEFT", self, -1, 1)
Threat:SetPoint("BOTTOMRIGHT", self, 1, -1)
Threat:SetFrameLevel(Health:GetFrameLevel() + 1)
Threat:SetBackdrop({edgeFile = Media:GetTexture("Blank"), edgeSize = UI.Mult})
Threat:SetBackdropColor(0, 0, 0, 0)
Threat:SetBackdropBorderColor(UI:GetTableColors(C["Raid"]["ThreatColor"].Value))
Threat:SetAlpha(0)
self.Threat = Threat
-- Ready Check
local ReadyCheck = Power:CreateTexture(nil, "OVERLAY")
ReadyCheck:SetHeight(12)
ReadyCheck:SetWidth(12)
ReadyCheck:SetPoint("CENTER")
self.ReadyCheck = ReadyCheck
self:SetAttribute("initial-width", C["Raid"]["FrameSize"].Value)
self:SetAttribute("initial-height", C["Raid"]["FrameSize"].Value)
end