Advertisement
Guest User

Untitled

a guest
Oct 6th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.90 KB | None | 0 0
  1. -- Variables
  2. local addon, ns = ...
  3. local oUF = ns.oUF or oUF  
  4.  
  5. -- Closest thing to a config
  6. local FONT = 'Interface\\AddOns\\media\\HOOG0557.ttf'
  7. local FONTSIZE = 8
  8. local FONTSTYLE = 'OUTLINE|MONOCHROME'
  9. local TEXTURE = 'Interface\\ChatFrame\\ChatFrameBackground'
  10. local BACKDROP = {
  11.         bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
  12. }
  13. local BARTEXTURE = 'Interface\\AddOns\\media\\tap2.tga'
  14. -- End of closest thing to a config
  15.  
  16. --[[
  17.         Makes the background of the healthbar classcolored, or falls back to bright red
  18. --]]
  19. local function Health_PostUpdate(bar, unit, health, maxHealth)
  20.    local _, class = UnitClass(unit)
  21.    local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class or ""]
  22.    if color then
  23.       bar.bg:SetVertexColor(color.r, color.g, color.b)
  24.    else
  25.       -- Fall back to red
  26.       bar.bg:SetVertexColor(1, 0, 0)
  27.    end
  28. end
  29.  
  30. -- Have to define UnitSpecific variable here so Shared has access to it or all things break
  31. local UnitSpecific
  32. -- Engine!
  33. local function Shared(self, unit)
  34.         self.colors.power.MANA = {1, 1, 1}
  35.  
  36.         self:RegisterForClicks('AnyUp')
  37.         self:SetScript('OnEnter', UnitFrame_OnEnter)
  38.         self:SetScript('OnLeave', UnitFrame_OnLeave)
  39.  
  40.         self:SetBackdrop(BACKDROP)
  41.         self:SetBackdropColor(0, 0, 0)
  42.  
  43.         local Health = CreateFrame('StatusBar', nil, self)
  44.         Health:SetStatusBarTexture(BARTEXTURE)
  45.         Health:SetStatusBarColor(53/255, 53/255, 53/255)
  46.         Health.frequentUpdates = true
  47.         self.Health = Health
  48.  
  49.         local HealthBG = Health:CreateTexture(nil, 'BORDER')
  50.         HealthBG:SetAllPoints()
  51.         HealthBG:SetTexture(BARTEXTURE)
  52.         Health.bg = HealthBG
  53.         Health.PostUpdate = Health_PostUpdate
  54.  
  55.         local text = Health:CreateFontString(nil, 'OVERLAY')
  56.         text:SetPoint('CENTER', 0, -1)
  57.         text:SetFont(FONT, FONTSIZE, FONTSTYLE)
  58.         text:SetJustifyH('CENTER')
  59.         text.frequentUpdates = 1/4
  60.         self.HealthValue = text
  61.  
  62.         local Power = CreateFrame('StatusBar', nil, self)
  63.         Power:SetPoint('BOTTOMRIGHT')
  64.         Power:SetPoint('BOTTOMLEFT')
  65.         Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  66.         Health:SetPoint('TOPRIGHT')
  67.         Health:SetPoint('TOPLEFT')
  68.         Power:SetStatusBarTexture(BARTEXTURE)
  69.         Power:SetStatusBarColor(53/255, 53/255, 53/255)            
  70.         Power.frequentUpdates = true
  71.         self.Power = Power
  72.  
  73.         local PowerBG = Power:CreateTexture(nil, 'BORDER')
  74.         PowerBG:SetAllPoints()
  75.         PowerBG:SetTexture(BARTEXTURE)
  76.         PowerBG:SetVertexColor(188/255, 188/255, 188/255)
  77.         Power.bg = PowerBG
  78.                
  79.         local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
  80.         RaidIcon:SetPoint('TOP', self, 0, 8)
  81.         RaidIcon:SetSize(16, 16)
  82.         self.RaidIcon = RaidIcon
  83.                
  84.         Health:SetHeight(20)
  85.  
  86.         self:SetHeight(24)
  87.        
  88.         local RoleIcon = self:CreateTexture(nil, 'ARTWORK')
  89.         RoleIcon:SetPoint('RIGHT', self, 'RIGHT', -3, 0)
  90.         RoleIcon:SetSize(14, 14)
  91.         RoleIcon:SetAlpha(1)
  92.         self.LFDRole = RoleIcon
  93.  
  94.         local ReadyCheck = self:CreateTexture(nil, 'OVERLAY')
  95.         ReadyCheck:SetPoint('LEFT', self, 'LEFT', 3, 0)
  96.         ReadyCheck:SetSize(14, 14)
  97.         self.ReadyCheck = ReadyCheck
  98.        
  99.         self:Tag(text, '[opraid]')
  100.  
  101.         self:HookScript('OnEnter', function() RoleIcon:SetAlpha(1) end)
  102.         self:HookScript('OnLeave', function() RoleIcon:SetAlpha(0) end)
  103.  
  104.         if(UnitSpecific[unit]) then
  105.                 return UnitSpecific[unit](self)
  106.         end
  107. end
  108.  
  109. UnitSpecific = {
  110. }
  111.  
  112.  
  113. oUF:RegisterStyle('opRaidDPS', Shared)
  114. oUF:SetActiveStyle('opRaidDPS')
  115.  
  116. local playerClass = select(3, UnitClass('player'))
  117. local raid, group, i, j
  118. -- Single Frames   
  119.  
  120. local attr = {
  121.     visibility1 = "custom [@raid11,exists] hide;[group:raid] show; hide",       --use "party,raid" to show this in party aswell
  122.     visibility2 = "custom [@raid26,exists] hide; [@raid11,exists] show; hide",  --special display for raid > 20 players (lower scale)
  123.     visibility3 = "custom [@raid26,exists] show; hide",                         --special display for raid > 30 players (lower scale)
  124. }
  125.  
  126. local function getRaidVisibility(id)
  127.     if id == 1 then
  128.         return attr.visibility1
  129.     elseif id == 2 then
  130.         return attr.visibility2
  131.     else
  132.         return attr.visibility3
  133.     end
  134. end  
  135.  
  136. for i=1, 3 do
  137.     raid = {}
  138.     for j=1, NUM_RAID_GROUPS do
  139.         local name = "oUF_OpieRaid"..i.."Group"..j
  140.         group = oUF:SpawnHeader(
  141.             name,
  142.             nil,
  143.             getRaidVisibility(i),
  144.             'showPlayer', true,
  145.             'showSolo', true,
  146.             'showParty', false,
  147.             'showRaid', true,
  148.             'yOffset', -4,
  149.             'maxColumns', 8,
  150.             'unitsPerColumn', 5,
  151.             "groupFilter", tostring(j),
  152.             'groupBy', 'GROUP',
  153.             'groupingOrder', "1,2,3,4,5,6,7,8",
  154.             'columnSpacing', 3,
  155.             'columnAnchorPoint', 'LEFT',
  156.                 'oUF-initialConfigFunction', ([[
  157.                         self:SetHeight(24)
  158.                         self:SetWidth(78)
  159.                 ]])
  160.         )          
  161.         if j == 1 then
  162.             group:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10)
  163.         else
  164.             if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  165.                 group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  166.             else
  167.                 group:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  168.             end
  169.         end
  170.         raid[j] = group
  171.     end
  172. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement