Advertisement
Guest User

Untitled

a guest
Oct 10th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.49 KB | None | 0 0
  1. -- Variables
  2. local addon, ns = ...
  3. local oUF = ns.oUF or oUF  
  4. local playerClass = select(3, UnitClass('player'))
  5.  
  6. -- Closest thing to a config
  7. local FONT = 'Interface\\AddOns\\media\\HOOG0557.ttf'
  8. local FONTSIZE = 8
  9. local FONTSTYLE = 'OUTLINE|MONOCHROME'
  10. local TEXTURE = 'Interface\\ChatFrame\\ChatFrameBackground'
  11. local BACKDROP = {
  12.         bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
  13. }
  14. local BARTEXTURE = 'Interface\\AddOns\\media\\tap2.tga'
  15. -- End of closest thing to a config
  16.  
  17. --[[
  18.         Makes the background of the healthbar classcolored, or falls back to bright red
  19. --]]
  20. local function Health_PostUpdate(bar, unit, health, maxHealth)
  21.    local _, class = UnitClass(unit)
  22.    local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class or ""]
  23.    if color then
  24.       bar.bg:SetVertexColor(color.r, color.g, color.b)
  25.    else
  26.       -- Fall back to red
  27.       bar.bg:SetVertexColor(1, 0, 0)
  28.    end
  29. end
  30.  
  31. -- Have to define UnitSpecific variable here so Shared has access to it or all things break
  32. local UnitSpecific
  33. -- Engine!
  34. local function opRaid10(self, unit)
  35.         self.colors.power.MANA = {1, 1, 1}
  36.  
  37.         self:RegisterForClicks('AnyUp')
  38.         self:SetScript('OnEnter', UnitFrame_OnEnter)
  39.         self:SetScript('OnLeave', UnitFrame_OnLeave)
  40.  
  41.         self:SetBackdrop(BACKDROP)
  42.         self:SetBackdropColor(0, 0, 0)
  43.  
  44.         local Health = CreateFrame('StatusBar', nil, self)
  45.         Health:SetStatusBarTexture(BARTEXTURE)
  46.         Health:SetStatusBarColor(53/255, 53/255, 53/255)
  47.         Health.frequentUpdates = true
  48.         self.Health = Health
  49.  
  50.         local HealthBG = Health:CreateTexture(nil, 'BORDER')
  51.         HealthBG:SetAllPoints()
  52.         HealthBG:SetTexture(BARTEXTURE)
  53.         Health.bg = HealthBG
  54.         Health.PostUpdate = Health_PostUpdate
  55.  
  56.         local text = Health:CreateFontString(nil, 'OVERLAY')
  57.         text:SetPoint('CENTER', 0, -1)
  58.         text:SetFont(FONT, FONTSIZE, FONTSTYLE)
  59.         text:SetJustifyH('CENTER')
  60.         text.frequentUpdates = 1/4
  61.         self.HealthValue = text
  62.         self:Tag(text, '[opraid]')
  63.  
  64.         local Power = CreateFrame('StatusBar', nil, self)
  65.         Power:SetPoint('BOTTOMRIGHT')
  66.         Power:SetPoint('BOTTOMLEFT')
  67.         Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  68.         Health:SetPoint('TOPRIGHT')
  69.         Health:SetPoint('TOPLEFT')
  70.         Power:SetStatusBarTexture(BARTEXTURE)
  71.         Power:SetStatusBarColor(53/255, 53/255, 53/255)            
  72.         Power.frequentUpdates = true
  73.         self.Power = Power
  74.  
  75.         local PowerBG = Power:CreateTexture(nil, 'BORDER')
  76.         PowerBG:SetAllPoints()
  77.         PowerBG:SetTexture(BARTEXTURE)
  78.         PowerBG:SetVertexColor(188/255, 188/255, 188/255)
  79.         Power.bg = PowerBG
  80.                
  81.         local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
  82.         RaidIcon:SetPoint('TOP', self, 0, 8)
  83.         RaidIcon:SetSize(16, 16)
  84.         self.RaidIcon = RaidIcon
  85.                
  86.         Health:SetHeight(20)
  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.         if(UnitSpecific[unit]) then
  95.                 return UnitSpecific[unit](self)
  96.         end
  97. end
  98.  
  99. -- 25 man layout
  100. local function opRaid25(self, unit)
  101.         self.colors.power.MANA = {1, 1, 1}
  102.  
  103.         self:RegisterForClicks('AnyUp')
  104.         self:SetScript('OnEnter', UnitFrame_OnEnter)
  105.         self:SetScript('OnLeave', UnitFrame_OnLeave)
  106.  
  107.         self:SetBackdrop(BACKDROP)
  108.         self:SetBackdropColor(0, 0, 0)
  109.  
  110.         local Health = CreateFrame('StatusBar', nil, self)
  111.         Health:SetStatusBarTexture(BARTEXTURE)
  112.         Health:SetStatusBarColor(53/255, 53/255, 53/255)
  113.         Health.frequentUpdates = true
  114.         self.Health = Health
  115.  
  116.         local HealthBG = Health:CreateTexture(nil, 'BORDER')
  117.         HealthBG:SetAllPoints()
  118.         HealthBG:SetTexture(BARTEXTURE)
  119.         Health.bg = HealthBG
  120.         Health.PostUpdate = Health_PostUpdate
  121.  
  122.         local name = Health:CreateFontString(nil, 'OVERLAY')
  123.         name:SetPoint('LEFT', self, 'RIGHT', 3, 0)
  124.         name:SetFont(FONT, FONTSIZE, FONTSTYLE)
  125.         name:SetJustifyH('LEFT')
  126.         name.frequentUpdates = 1/4
  127.         self.HealthValue = name
  128.         self:Tag(name, '[opnameraid25]')
  129.  
  130.         Health:SetAllPoints()
  131.                
  132.         local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
  133.         RaidIcon:SetPoint('TOP', self, 0, 8)
  134.         RaidIcon:SetSize(16, 16)
  135.         self.RaidIcon = RaidIcon
  136.                
  137.         -- Health:SetHeight(20)
  138.  
  139.         local ReadyCheck = self:CreateTexture(nil, 'OVERLAY')
  140.         ReadyCheck:SetPoint('LEFT', self, 'LEFT', 3, 0)
  141.         ReadyCheck:SetSize(14, 14)
  142.         self.ReadyCheck = ReadyCheck
  143.  
  144.         if(UnitSpecific[unit]) then
  145.                 return UnitSpecific[unit](self)
  146.         end
  147. end
  148.  
  149. UnitSpecific = {
  150. }
  151. --UnitSpecific.raid = UnitSpecific.party
  152.  
  153. oUF:RegisterStyle('opRaidDPS10', opRaid10)
  154. oUF:RegisterStyle('opRaidDPS25', opRaid25)
  155.  
  156. --spawn 10man
  157. oUF:SetActiveStyle('opRaidDPS10')
  158.  
  159. local raid10Header = oUF:SpawnHeader(
  160.     "oUF_OpieRaid10Header",
  161.     nil,
  162.     "custom [@raid11,exists] hide;[@raid1,exists] show; hide",
  163.     'showPlayer', true,
  164.     'showSolo', false,
  165.     'showParty', false,
  166.     'showRaid', true,
  167.     'yOffset', -3,
  168.     'maxColumns', 8,
  169.     'unitsPerColumn', 5,
  170.     'groupBy', 'GROUP',
  171.     'groupingOrder', "1,2,3,4,5,6,7,8",
  172.     'columnSpacing', 3,
  173.     'columnAnchorPoint', 'LEFT',
  174.         'oUF-initialConfigFunction', ([[
  175.                 self:SetHeight(24)
  176.                 self:SetWidth(78)
  177.         ]])
  178. )          
  179. raid10Header:SetPoint('TOP', oUF_opUnitFramesPlayer, 'BOTTOM', 0, -10) -- top of header set to bottom of player frame
  180.  
  181. --spawn 25man
  182. oUF:SetActiveStyle('opRaidDPS25')
  183.  
  184. local raid25Header = oUF:SpawnHeader(
  185.     "oUF_OpieRaid25Header",
  186.     nil,
  187.     "custom [@raid11,exists] show; hide",
  188.     'showPlayer', true,
  189.     'showSolo', false,
  190.     'showParty', false,
  191.     'showRaid', true,
  192.     'yOffset', -3,
  193.     'xOffset', 0,
  194.     'point', 'TOP',
  195.     'maxColumns', 8,
  196.     'unitsPerColumn', nil,
  197.     'groupBy', 'GROUP',
  198.     'groupingOrder', "1,2,3,4,5,6,7,8",
  199.     'columnSpacing', 3,
  200.     'columnAnchorPoint', 'TOP',
  201.         'oUF-initialConfigFunction', ([[
  202.                 self:SetHeight(16)
  203.                 self:SetWidth(100)
  204.         ]])
  205. )  
  206. if playerClass == 9 or playerClass == 3 or playerClass == 6 then
  207.     raid25Header:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -28)
  208. else
  209.     raid25Header:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 5, -5)
  210. end
  211.  
  212. --[[
  213. local raidResize = function(self, event, ...)  
  214.     local raidSize = GetNumGroupMembers()
  215.    
  216.     if raidSize <= 10 then
  217.         oUF:SetActiveStyle('opRaidDPS10')
  218.     elseif raidSize > 10 then
  219.         oUF:SetActiveStyle('opRaidDPS25')
  220.     end
  221. end
  222.  
  223. local updateRaid = CreateFrame("Frame")
  224. updateRaid:RegisterEvent("GROUP_ROSTER_UPDATE")
  225. updateRaid:RegisterEvent("PLAYER_ENTERING_WORLD")
  226. updateRaid:SetScript("OnEvent", function(self)
  227.     if(InCombatLockdown()) then
  228.         self:RegisterEvent('PLAYER_REGEN_ENABLED')
  229.     else
  230.         self:UnregisterEvent('PLAYER_REGEN_ENABLED')
  231.  
  232.         raidResize()
  233.     end
  234. end)
  235. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement