Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local addon, ns = ...
- local oUF = ns.oUF or oUF
- -- Closest thing to a config
- local FONT = 'Interface\\AddOns\\media\\HOOG0557.ttf'
- local FONTSIZE = 8
- local FONTSTYLE = 'OUTLINE|MONOCHROME'
- local TEXTURE = 'Interface\\ChatFrame\\ChatFrameBackground'
- local BACKDROP = {
- bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
- }
- local BARTEXTURE = 'Interface\\AddOns\\media\\tap2.tga'
- -- End of closest thing to a config
- --[[
- Makes the background of the healthbar classcolored, or falls back to bright red
- --]]
- local function Health_PostUpdate(bar, unit, health, maxHealth)
- local _, class = UnitClass(unit)
- local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class or ""]
- if color then
- bar.bg:SetVertexColor(color.r, color.g, color.b)
- else
- -- Fall back to red
- bar.bg:SetVertexColor(1, 0, 0)
- end
- end
- -- Have to define UnitSpecific variable here so Shared has access to it or all things break
- local UnitSpecific
- -- Engine!
- local function Shared(self, unit)
- self.colors.power.MANA = {1, 1, 1}
- self:RegisterForClicks('AnyUp')
- self:SetScript('OnEnter', UnitFrame_OnEnter)
- self:SetScript('OnLeave', UnitFrame_OnLeave)
- self:SetBackdrop(BACKDROP)
- self:SetBackdropColor(0, 0, 0)
- local Health = CreateFrame('StatusBar', nil, self)
- Health:SetStatusBarTexture(BARTEXTURE)
- Health:SetStatusBarColor(53/255, 53/255, 53/255)
- Health.frequentUpdates = true
- self.Health = Health
- local HealthBG = Health:CreateTexture(nil, 'BORDER')
- HealthBG:SetAllPoints()
- HealthBG:SetTexture(BARTEXTURE)
- Health.bg = HealthBG
- Health.PostUpdate = Health_PostUpdate
- local text = Health:CreateFontString(nil, 'OVERLAY')
- text:SetPoint('CENTER', 0, -1)
- text:SetFont(FONT, FONTSIZE, FONTSTYLE)
- text:SetJustifyH('CENTER')
- text.frequentUpdates = 1/4
- self.HealthValue = text
- local Power = CreateFrame('StatusBar', nil, self)
- Power:SetPoint('BOTTOMRIGHT')
- Power:SetPoint('BOTTOMLEFT')
- Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
- Health:SetPoint('TOPRIGHT')
- Health:SetPoint('TOPLEFT')
- Power:SetStatusBarTexture(BARTEXTURE)
- Power:SetStatusBarColor(53/255, 53/255, 53/255)
- Power.frequentUpdates = true
- self.Power = Power
- local PowerBG = Power:CreateTexture(nil, 'BORDER')
- PowerBG:SetAllPoints()
- PowerBG:SetTexture(BARTEXTURE)
- PowerBG:SetVertexColor(188/255, 188/255, 188/255)
- Power.bg = PowerBG
- local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
- RaidIcon:SetPoint('TOP', self, 0, 8)
- RaidIcon:SetSize(16, 16)
- self.RaidIcon = RaidIcon
- Health:SetHeight(20)
- self:SetHeight(24)
- local RoleIcon = self:CreateTexture(nil, 'ARTWORK')
- RoleIcon:SetPoint('RIGHT', self, 'RIGHT', -3, 0)
- RoleIcon:SetSize(14, 14)
- RoleIcon:SetAlpha(1)
- self.LFDRole = RoleIcon
- local ReadyCheck = self:CreateTexture(nil, 'OVERLAY')
- ReadyCheck:SetPoint('LEFT', self, 'LEFT', 3, 0)
- ReadyCheck:SetSize(14, 14)
- self.ReadyCheck = ReadyCheck
- self:Tag(text, '[opraid]')
- self:HookScript('OnEnter', function() RoleIcon:SetAlpha(1) end)
- self:HookScript('OnLeave', function() RoleIcon:SetAlpha(0) end)
- if(UnitSpecific[unit]) then
- return UnitSpecific[unit](self)
- end
- end
- UnitSpecific = {
- }
- oUF:RegisterStyle('opRaidDPS', Shared)
- oUF:SetActiveStyle('opRaidDPS')
- local playerClass = select(3, UnitClass('player'))
- local raid, group, i, j
- -- Single Frames
- local attr = {
- visibility1 = "custom [@raid11,exists] hide;[group:raid] show; hide", --use "party,raid" to show this in party aswell
- visibility2 = "custom [@raid26,exists] hide; [@raid11,exists] show; hide", --special display for raid > 20 players (lower scale)
- visibility3 = "custom [@raid26,exists] show; hide", --special display for raid > 30 players (lower scale)
- }
- local function getRaidVisibility(id)
- if id == 1 then
- return attr.visibility1
- elseif id == 2 then
- return attr.visibility2
- else
- return attr.visibility3
- end
- end
- for i=1, 3 do
- raid = {}
- for j=1, NUM_RAID_GROUPS do
- local name = "oUF_OpieRaid"..i.."Group"..j
- group = oUF:SpawnHeader(
- name,
- nil,
- getRaidVisibility(i),
- 'showPlayer', true,
- 'showSolo', true,
- 'showParty', false,
- 'showRaid', true,
- 'yOffset', -4,
- 'maxColumns', 8,
- 'unitsPerColumn', 5,
- "groupFilter", tostring(j),
- 'groupBy', 'GROUP',
- 'groupingOrder', "1,2,3,4,5,6,7,8",
- 'columnSpacing', 3,
- 'columnAnchorPoint', 'LEFT',
- 'oUF-initialConfigFunction', ([[
- self:SetHeight(24)
- self:SetWidth(78)
- ]])
- )
- if j == 1 then
- group:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
- else
- if playerClass == 9 or playerClass == 3 or playerClass == 6 then
- group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
- else
- group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
- end
- end
- raid[j] = group
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement