Guest User

oUF_P3lim

a guest
Nov 7th, 2013
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3.   Adrian L Lange grants anyone the right to use this work for any purpose,
  4.   without any conditions, unless such conditions are required by law.
  5.  
  6. --]]
  7.  
  8. local _, ns = ...
  9. local oUF = ns.oUF
  10.  
  11. local FONT = [=[Interface\AddOns\oUF_P3lim\semplice.ttf]=]
  12. local TEXTURE = [=[Interface\ChatFrame\ChatFrameBackground]=]
  13. local BACKDROP = {
  14.     bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
  15. }
  16.  
  17. local UpdateComboPoints
  18. do
  19.     local spells = {
  20.         [1822] = true, -- Rake
  21.         [5221] = true, -- Shred
  22.         [6785] = true, -- Ravage
  23.         [33876] = true, -- Mangle
  24.         [102545] = true, -- Ravage!
  25.         [114236] = true, -- Shred!
  26.     }
  27.  
  28.     local min = math.min
  29.     local count, form = 0
  30.     local playerGUID
  31.  
  32.     function UpdateCombo(self, event, ...)
  33.         if(event == 'COMBAT_LOG_EVENT_UNFILTERED') then
  34.             local _, param, _, source, _, _, _, destination, _, _, _, spell, _, _, _, _, _, _, _, _, crit = ...
  35.             if(form and param == 'SPELL_DAMAGE' and source == playerGUID and destination == UnitGUID('target')) then
  36.                 if(spells[spell] and crit) then
  37.                     count = min(count + 1, 5)
  38.                 end
  39.             end
  40.         elseif(event == 'UPDATE_SHAPESHIFT_FORM') then
  41.             if(not playerGUID) then
  42.                 playerGUID = UnitGUID('player')
  43.             end
  44.  
  45.             form = GetShapeshiftForm() == 3
  46.         else
  47.             if(UnitHasVehicleUI('player')) then
  48.                 count = GetComboPoints('vehicle', 'target')
  49.             else
  50.                 count = GetComboPoints('player', 'target')
  51.             end
  52.         end
  53.  
  54.         local element = self.ComboPoints
  55.         if(count > 0) then
  56.             element:SetText(count)
  57.         else
  58.             element:SetText()
  59.         end
  60.     end
  61. end
  62.  
  63. local function PostUpdatePower(element, unit, min, max)
  64.     element:GetParent().Health:SetHeight(max ~= 0 and 20 or 22)
  65. end
  66.  
  67. local function PostUpdateCast(element, unit)
  68.     local Spark = element.Spark
  69.     if(not element.interrupt and UnitCanAttack('player', unit)) then
  70.         Spark:SetTexture(1, 0, 0)
  71.     else
  72.         Spark:SetTexture(1, 1, 1)
  73.     end
  74. end
  75.  
  76. local function UpdateRuneState(self)
  77.     local opacity
  78.     if(UnitHasVehicleUI('player') or UnitIsDeadOrGhost('player')) then
  79.         opacity = 0
  80.     elseif(UnitAffectingCombat('player')) then
  81.         opacity = 1
  82.     elseif(UnitExists('target') and UnitCanAttack('player', 'target')) then
  83.         opacity = 0.8
  84.     else
  85.         opacity = 0
  86.  
  87.         for index = 1, 6 do
  88.             local _, _, ready = GetRuneCooldown(index)
  89.             if(not ready) then
  90.                 opacity = 0.5
  91.                 break
  92.             end
  93.         end
  94.     end
  95.  
  96.     local current = self:GetAlpha()
  97.     if(opacity > current) then
  98.         UIFrameFadeIn(self, 1/4, current, opacity)
  99.     elseif(opacity < current) then
  100.         UIFrameFadeOut(self, 1/4, current, opacity)
  101.     end
  102. end
  103.  
  104. local function UpdateRunes(self, elapsed)
  105.     local duration = self.duration + elapsed
  106.     if(duration >= 1) then
  107.         self:SetScript('OnUpdate', nil)
  108.     else
  109.         self.duration = duration
  110.         self:SetValue(math.max(duration, 0))
  111.     end
  112.  
  113.     local Background = self.Background
  114.     if(Background:GetHeight() <= 2.1) then
  115.         Background:Hide()
  116.     else
  117.         Background:Show()
  118.     end
  119. end
  120.  
  121. local function PostUpdateRune(element, Rune, id, start, duration, ready)
  122.     local Overlay = Rune.Overlay
  123.     if(ready) then
  124.         Overlay:SetValue(1)
  125.         Overlay:SetScript('OnUpdate', nil)
  126.         Overlay.Background:Show()
  127.     else
  128.         Overlay.duration = GetTime() - (start + duration - 1)
  129.         Overlay:SetScript('OnUpdate', UpdateRunes)
  130.     end
  131. end
  132.  
  133. local function PostUpdateRuneType(element, Rune)
  134.     local r, g, b = Rune:GetStatusBarColor()
  135.     Rune:SetStatusBarColor(r * 0.7, g * 0.7, b * 0.7)
  136.     Rune.Overlay:SetStatusBarColor(r, g, b)
  137. end
  138.  
  139. local function UpdateAura(self, elapsed)
  140.     if(self.expiration) then
  141.         if(self.expiration < 60) then
  142.             self.remaining:SetFormattedText('%d', self.expiration)
  143.         else
  144.             self.remaining:SetText()
  145.         end
  146.  
  147.         self.expiration = self.expiration - elapsed
  148.     end
  149. end
  150.  
  151. local function PostCreateAura(element, button)
  152.     button:SetBackdrop(BACKDROP)
  153.     button:SetBackdropColor(0, 0, 0)
  154.     button.cd:SetReverse()
  155.     button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  156.     button.icon:SetDrawLayer('ARTWORK')
  157.  
  158.     button.count:SetPoint('BOTTOMRIGHT', 2, 1)
  159.     button.count:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
  160.  
  161.     local remaining = button:CreateFontString(nil, 'OVERLAY')
  162.     remaining:SetPoint('TOPLEFT', 0, -1)
  163.     remaining:SetFont(FONT, 8, 'OUTLINEMONOCROME')
  164.     button.remaining = remaining
  165.  
  166.     button:HookScript('OnUpdate', UpdateAura)
  167. end
  168.  
  169. local function PostUpdateBuff(element, unit, button, index)
  170.     local _, _, _, _, _, duration, expiration = UnitAura(unit, index, button.filter)
  171.  
  172.     if(duration and duration > 0) then
  173.         button.expiration = expiration - GetTime()
  174.     else
  175.         button.expiration = math.huge
  176.     end
  177. end
  178.  
  179. local function PostUpdateDebuff(element, unit, button, index)
  180.     local _, _, _, _, type, _, _, owner = UnitAura(unit, index, button.filter)
  181.  
  182.     if(owner == 'player') then
  183.         local color = DebuffTypeColor[type or 'none']
  184.         button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
  185.         button.icon:SetDesaturated(false)
  186.     else
  187.         button:SetBackdropColor(0, 0, 0)
  188.         button.icon:SetDesaturated(true)
  189.     end
  190.  
  191.     PostUpdateBuff(element, unit, button, index)
  192. end
  193.  
  194. local FilterPlayerBuffs
  195. do
  196.     local spells = {
  197.         -- Druid
  198.         [5217] = true, -- Tiger's Fury
  199.         [52610] = true, -- Savage Roar
  200.         [106951] = true, -- Berserk
  201.         [127538] = true, -- Savage Roar (glyphed)
  202.         [124974] = true, -- Nature's Vigil
  203.         [132158] = true, -- Nature's Swiftness
  204.         [132402] = true, -- Savage Defense
  205.  
  206.         -- Rogue
  207.         [5171] = true, -- Slice and Dice
  208.         [31224] = true, -- Cloak of Shadows
  209.         [32645] = true, -- Envenom
  210.         [73651] = true, -- Recuperate
  211.         [121471] = true, -- Shadow Blades
  212.         [115189] = true, -- Anticipation
  213.  
  214.         -- Death Knight
  215.         [48707] = true, -- Anti-Magic Shell
  216.         [51271] = true, -- Pillar of Frost
  217.         [53365] = true, -- Rune of the Fallen Crusader
  218.  
  219.         -- Shared
  220.         [32182] = true, -- Heroism
  221.         [57933] = true, -- Tricks of the Trade
  222.         [80353] = true, -- Time Warp
  223.     }
  224.  
  225.     if(select(2, UnitClass('player')) == 'DEATHKNIGHT') then
  226.         spells[57330] = true -- Horn of Winter
  227.     end
  228.  
  229.     function FilterPlayerBuffs(...)
  230.         local _, _, _, _, _, _, _, _, _, _, _, _, _, id = ...
  231.         return spells[id]
  232.     end
  233. end
  234.  
  235. local FilterTargetDebuffs
  236. do
  237.     local show = {
  238.         [1490] = true, -- Curse of Elements (Magic Vulnerability)
  239.         [58410] = true, -- Master Poisoner (Magic Vulnerability)
  240.         [81326] = true, -- Physical Vulnerability (Shared)
  241.         [113746] = true, -- Weakened Armor (Shared)
  242.     }
  243.  
  244.     local hide = {
  245.         [770] = true, -- Faerie Fire
  246.         [58180] = true, -- Infected Wounds
  247.         [115798] = true, -- Weakened Blows
  248.     }
  249.  
  250.     function FilterTargetDebuffs(...)
  251.         local _, unit, _, _, _, _, _, _, _, _, owner, _, _, id = ...
  252.  
  253.         if(owner == 'player' and hide[id]) then
  254.             return false
  255.         elseif(owner == 'player' or owner == 'vehicle' or UnitIsFriend('player', unit) or show[id] or not owner) then
  256.             return true
  257.         end
  258.     end
  259. end
  260.  
  261. local UnitSpecific = {
  262.     player = function(self)
  263.         local PowerValue = self.Health:CreateFontString(nil, 'OVERLAY')
  264.         PowerValue:SetPoint('LEFT', 2, 0)
  265.         PowerValue:SetPoint('RIGHT', self.HealthValue, 'LEFT', -3)
  266.         PowerValue:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
  267.         PowerValue:SetJustifyH('LEFT')
  268.         PowerValue.frequentUpdates = 0.1
  269.         self:Tag(PowerValue, '[|cffffff00>holypower<|r ][p3lim:power][ >p3lim:druid][ | >p3lim:spell]')
  270.  
  271.         local Experience = CreateFrame('StatusBar', nil, self)
  272.         Experience:SetPoint('BOTTOM', 0, -20)
  273.         Experience:SetSize(230, 6)
  274.         Experience:SetStatusBarTexture(TEXTURE)
  275.         Experience:SetStatusBarColor(0.15, 0.7, 0.1)
  276.         self.Experience = Experience
  277.  
  278.         local Rested = CreateFrame('StatusBar', nil, Experience)
  279.         Rested:SetAllPoints()
  280.         Rested:SetStatusBarTexture(TEXTURE)
  281.         Rested:SetStatusBarColor(0, 0.4, 1, 0.6)
  282.         Rested:SetBackdrop(BACKDROP)
  283.         Rested:SetBackdropColor(0, 0, 0)
  284.         Experience.Rested = Rested
  285.  
  286.         local ExperienceBG = Rested:CreateTexture(nil, 'BORDER')
  287.         ExperienceBG:SetAllPoints()
  288.         ExperienceBG:SetTexture(1/3, 1/3, 1/3)
  289.  
  290.         local AltPower = CreateFrame('StatusBar', nil, self)
  291.         AltPower:SetPoint('BOTTOM', 0, -10)
  292.         AltPower:SetSize(230, 6)
  293.         AltPower:SetStatusBarTexture(TEXTURE)
  294.         AltPower:SetStatusBarColor(0.15, 0.7, 0.1)
  295.         AltPower:SetBackdrop(BACKDROP)
  296.         AltPower:SetBackdropColor(0, 0, 0)
  297.         AltPower:EnableMouse(true)
  298.         AltPower.colorTexture = true
  299.         self.AltPowerBar = AltPower
  300.  
  301.         local AltPowerBG = AltPower:CreateTexture(nil, 'BORDER')
  302.         AltPowerBG:SetAllPoints()
  303.         AltPowerBG:SetTexture(1/3, 1/3, 1/3)
  304.  
  305.         local playerClass = select(3, UnitClass('player'))
  306.         if(playerClass == 6) then
  307.             local Parent = CreateFrame('Frame', nil, UIParent)
  308.             Parent:SetPoint('CENTER', 0, -230)
  309.             Parent:SetSize(82, 40)
  310.  
  311.             Parent:RegisterEvent('UNIT_EXITED_VEHICLE')
  312.             Parent:RegisterEvent('UNIT_ENTERED_VEHICLE')
  313.             Parent:RegisterEvent('PLAYER_ENTERING_WORLD')
  314.             Parent:RegisterEvent('PLAYER_TARGET_CHANGED')
  315.             Parent:RegisterEvent('PLAYER_REGEN_DISABLED')
  316.             Parent:RegisterEvent('PLAYER_REGEN_ENABLED')
  317.             Parent:RegisterEvent('RUNE_POWER_UPDATE')
  318.             Parent:SetScript('OnEvent', UpdateRuneState)
  319.  
  320.             local Runes = {}
  321.             for index = 1, 6 do
  322.                 local Rune = CreateFrame('StatusBar', nil, Parent)
  323.                 Rune:SetPoint('BOTTOMLEFT', 3 + (index - 1) * 13, 0)
  324.                 Rune:SetSize(10, 38)
  325.                 Rune:SetOrientation('VERTICAL')
  326.                 Rune:SetStatusBarTexture(TEXTURE)
  327.                 Rune:SetAlpha(0.7)
  328.  
  329.                 local Overlay = CreateFrame('StatusBar', nil, Parent)
  330.                 Overlay:SetAllPoints(Rune)
  331.                 Overlay:SetOrientation('VERTICAL')
  332.                 Overlay:SetStatusBarTexture(TEXTURE)
  333.                 Overlay:SetMinMaxValues(0, 1)
  334.                 Overlay:SetFrameLevel(3)
  335.                 Rune.Overlay = Overlay
  336.  
  337.                 local RuneBG = Parent:CreateTexture(nil, 'BORDER')
  338.                 RuneBG:SetPoint('BOTTOM', Rune, 0, -1)
  339.                 RuneBG:SetPoint('TOP', Rune:GetStatusBarTexture(), 0, 1)
  340.                 RuneBG:SetSize(12, 40)
  341.                 RuneBG:SetTexture(0, 0, 0)
  342.                 Overlay.Background = RuneBG
  343.  
  344.                 Runes[index] = Rune
  345.             end
  346.  
  347.             Runes.PostUpdateRune = PostUpdateRune
  348.             Runes.PostUpdateType = PostUpdateRuneType
  349.  
  350.             self.Runes = Runes
  351.  
  352.             self.colors.runes[1] = {0.9, 0.15, 0.15}
  353.             self.colors.runes[2] = {0.4, 0.9, 0.3}
  354.             self.colors.runes[3] = {0, 0.7, 0.9}
  355.             self.colors.runes[4] = {0.5, 0.27, 0.68}
  356.         end
  357.  
  358.         self.Debuffs.size = 22
  359.         self.Debuffs:SetSize(230, 22)
  360.         self.Debuffs.PostUpdateIcon = PostUpdateBuff
  361.         self.Buffs.PostUpdateIcon = PostUpdateBuff
  362.         self.Buffs.CustomFilter = FilterPlayerBuffs
  363.  
  364.         self:Tag(self.HealthValue, '[p3lim:status][p3lim:player]')
  365.         self:SetWidth(230)
  366.     end,
  367.     target = function(self)
  368.         local ComboPoints = self:CreateFontString(nil, 'OVERLAY', 'SubZoneTextFont')
  369.         ComboPoints:SetPoint('RIGHT', self, 'LEFT', -9, 0)
  370.         ComboPoints:SetJustifyH('RIGHT')
  371.         ComboPoints:SetTextColor(1, 1, 1)
  372.  
  373.         if(select(3, UnitClass('player')) == 11) then
  374.             self.ComboPoints = ComboPoints
  375.  
  376.             self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED', UpdateCombo, true)
  377.             self:RegisterEvent('UPDATE_SHAPESHIFT_FORM', UpdateCombo, true)
  378.             self:RegisterEvent('PLAYER_TARGET_CHANGED', UpdateCombo, true)
  379.             self:RegisterEvent('UNIT_COMBO_POINTS', UpdateCombo, true)
  380.  
  381.             table.insert(self.__elements, UpdateCombo)
  382.         else
  383.             self:Tag(ComboPoints, '[cpoints]')
  384.         end
  385.  
  386.         self.Castbar.PostCastStart = PostUpdateCast
  387.         self.Castbar.PostCastInterruptible = PostUpdateCast
  388.         self.Castbar.PostCastNotInterruptible = PostUpdateCast
  389.         self.Castbar.PostChannelStart = PostUpdateCast
  390.  
  391.         self.Debuffs.size = 19.4
  392.         self.Debuffs['growth-y'] = 'DOWN'
  393.         self.Debuffs:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -4)
  394.         self.Debuffs:SetSize(230, 19.4)
  395.         self.Debuffs.CustomFilter = FilterTargetDebuffs
  396.         self.Debuffs.PostUpdateIcon = PostUpdateDebuff
  397.  
  398.         self.Power.PostUpdate = PostUpdatePower
  399.         self:Tag(self.HealthValue, '[p3lim:status][p3lim:hostile][p3lim:friendly]')
  400.         self:SetWidth(230)
  401.     end,
  402.     party = function(self)
  403.         local Name = self.Health:CreateFontString(nil, 'OVERLAY')
  404.         Name:SetPoint('LEFT', 3, 0)
  405.         Name:SetPoint('RIGHT', self.HealthValue, 'LEFT')
  406.         Name:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
  407.         Name:SetJustifyH('LEFT')
  408.         self:Tag(Name, '[p3lim:unbuffed< ][p3lim:leader][raidcolor][name]')
  409.  
  410.         local RoleIcon = self:CreateTexture(nil, 'ARTWORK')
  411.         RoleIcon:SetPoint('LEFT', self, 'RIGHT', 3, 0)
  412.         RoleIcon:SetSize(14, 14)
  413.         RoleIcon:SetAlpha(0)
  414.         self.LFDRole = RoleIcon
  415.  
  416.         local ReadyCheck = self:CreateTexture(nil, 'OVERLAY')
  417.         ReadyCheck:SetPoint('LEFT', self, 'RIGHT', 3, 0)
  418.         ReadyCheck:SetSize(14, 14)
  419.         self.ReadyCheck = ReadyCheck
  420.  
  421.         self:HookScript('OnEnter', function() RoleIcon:SetAlpha(1) end)
  422.         self:HookScript('OnLeave', function() RoleIcon:SetAlpha(0) end)
  423.  
  424.         self.Health:SetAllPoints()
  425.         self:Tag(self.HealthValue, '[p3lim:status][p3lim:percent]')
  426.     end,
  427.     boss = function(self)
  428.         self:SetSize(126, 19)
  429.         self.Health:SetAllPoints()
  430.         self:Tag(self.HealthValue, '[p3lim:percent]')
  431.     end
  432. }
  433. UnitSpecific.raid = UnitSpecific.party
  434.  
  435. local function Shared(self, unit)
  436.     unit = unit:match('(boss)%d?$') or unit
  437.  
  438.     self.colors.power.MANA = {0, 144/255, 1}
  439.  
  440.     self:RegisterForClicks('AnyUp')
  441.     self:SetScript('OnEnter', UnitFrame_OnEnter)
  442.     self:SetScript('OnLeave', UnitFrame_OnLeave)
  443.  
  444.     self:SetBackdrop(BACKDROP)
  445.     self:SetBackdropColor(0, 0, 0)
  446.  
  447.     local Health = CreateFrame('StatusBar', nil, self)
  448.     Health:SetStatusBarTexture(TEXTURE)
  449.     Health:SetStatusBarColor(1/6, 1/6, 2/7)
  450.     Health.frequentUpdates = true
  451.     self.Health = Health
  452.  
  453.     local HealthBG = Health:CreateTexture(nil, 'BORDER')
  454.     HealthBG:SetAllPoints()
  455.     HealthBG:SetTexture(1/3, 1/3, 1/3)
  456.  
  457.     local HealthValue = Health:CreateFontString(nil, 'OVERLAY')
  458.     HealthValue:SetPoint('RIGHT', -2, 0)
  459.     HealthValue:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
  460.     HealthValue:SetJustifyH('RIGHT')
  461.     HealthValue.frequentUpdates = 1/4
  462.     self.HealthValue = HealthValue
  463.  
  464.     if(unit == 'player' or unit == 'target') then
  465.         local Power = CreateFrame('StatusBar', nil, self)
  466.         Power:SetPoint('BOTTOMRIGHT')
  467.         Power:SetPoint('BOTTOMLEFT')
  468.         Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  469.         Power:SetStatusBarTexture(TEXTURE)
  470.         Power.frequentUpdates = true
  471.         self.Power = Power
  472.  
  473.         Power.colorClass = true
  474.         Power.colorTapping = true
  475.         Power.colorDisconnected = true
  476.         Power.colorReaction = true
  477.  
  478.         local PowerBG = Power:CreateTexture(nil, 'BORDER')
  479.         PowerBG:SetAllPoints()
  480.         PowerBG:SetTexture(TEXTURE)
  481.         PowerBG.multiplier = 1/3
  482.         Power.bg = PowerBG
  483.  
  484.         local Buffs = CreateFrame('Frame', nil, self)
  485.         Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0)
  486.         Buffs:SetSize(236, 44)
  487.         Buffs.num = 20
  488.         Buffs.size = 22
  489.         Buffs.spacing = 4
  490.         Buffs.initialAnchor = 'TOPLEFT'
  491.         Buffs['growth-y'] = 'DOWN'
  492.         Buffs.PostCreateIcon = PostCreateAura
  493.         self.Buffs = Buffs
  494.  
  495.         local Castbar = CreateFrame('StatusBar', nil, self)
  496.         Castbar:SetAllPoints(Health)
  497.         Castbar:SetStatusBarTexture(TEXTURE)
  498.         Castbar:SetStatusBarColor(0, 0, 0, 0)
  499.         Castbar:SetFrameStrata('HIGH')
  500.         self.Castbar = Castbar
  501.  
  502.         local Spark = Castbar:CreateTexture(nil, 'OVERLAY')
  503.         Spark:SetSize(2, 20)
  504.         Spark:SetTexture(1, 1, 1)
  505.         Castbar.Spark = Spark
  506.  
  507.         local RaidIcon = Health:CreateTexture(nil, 'OVERLAY')
  508.         RaidIcon:SetPoint('TOP', self, 0, 8)
  509.         RaidIcon:SetSize(16, 16)
  510.         self.RaidIcon = RaidIcon
  511.  
  512.         Health:SetHeight(20)
  513.         Health:SetPoint('TOPRIGHT')
  514.         Health:SetPoint('TOPLEFT')
  515.  
  516.         self:SetHeight(22)
  517.     end
  518.  
  519.     if(unit ~= 'player' and unit ~= 'party' and unit ~= 'raid') then
  520.         local Name = Health:CreateFontString(nil, 'OVERLAY')
  521.         Name:SetPoint('LEFT', 2, 0)
  522.         Name:SetPoint('RIGHT', HealthValue, 'LEFT')
  523.         Name:SetFont(FONT, 8, 'OUTLINEMONOCHROME')
  524.         Name:SetJustifyH('LEFT')
  525.         self:Tag(Name, '[p3lim:color][name][ |cff0090ff>rare<|r]')
  526.     end
  527.  
  528.     if(unit ~= 'party' and unit ~= 'raid' and unit ~= 'boss') then
  529.         local Debuffs = CreateFrame('Frame', nil, self)
  530.         Debuffs.spacing = 4
  531.         Debuffs.initialAnchor = 'TOPLEFT'
  532.         Debuffs.PostCreateIcon = PostCreateAura
  533.         self.Debuffs = Debuffs
  534.  
  535.         if(unit == 'focus') then
  536.             Debuffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0)
  537.             Debuffs.onlyShowPlayer = true
  538.         elseif(unit ~= 'target') then
  539.             Debuffs:SetPoint('TOPRIGHT', self, 'TOPLEFT', -4, 0)
  540.             Debuffs.initialAnchor = 'TOPRIGHT'
  541.             Debuffs['growth-x'] = 'LEFT'
  542.         end
  543.  
  544.         if(unit == 'focus' or unit == 'targettarget') then
  545.             Debuffs.num = 3
  546.             Debuffs.size = 19
  547.             Debuffs:SetSize(230, 19)
  548.  
  549.             Health:SetAllPoints()
  550.             self:SetSize(161, 19)
  551.         end
  552.     end
  553.  
  554.     if(UnitSpecific[unit]) then
  555.         return UnitSpecific[unit](self)
  556.     end
  557. end
  558.  
  559. oUF:RegisterStyle('P3lim', Shared)
  560. oUF:Factory(function(self)
  561.     self:SetActiveStyle('P3lim')
  562.     self:Spawn('player'):SetPoint('CENTER', -300, -250)
  563.     self:Spawn('focus'):SetPoint('TOPLEFT', oUF_P3limPlayer, 0, 26)
  564.     self:Spawn('target'):SetPoint('CENTER', 300, -250)
  565.     self:Spawn('targettarget'):SetPoint('TOPRIGHT', oUF_P3limTarget, 0, 26)
  566.  
  567.     self:SpawnHeader(nil, nil, 'custom [group:party] show; [@raid3,exists] show; [@raid26,exists] hide; hide',
  568.         'showParty', true, 'showRaid', true, 'showPlayer', true, 'yOffset', -6,
  569.         'oUF-initialConfigFunction', [[
  570.             self:SetHeight(16)
  571.             self:SetWidth(126)
  572.         ]]
  573.     ):SetPoint('TOP', Minimap, 'BOTTOM', 0, -10)
  574.  
  575.     for index = 1, MAX_BOSS_FRAMES do
  576.         local boss = self:Spawn('boss' .. index)
  577.         if(index == 1) then
  578.             boss:SetPoint('TOP', oUF_P3limRaid or Minimap, 'BOTTOM', 0, -20)
  579.         else
  580.             boss:SetPoint('TOP', _G['oUF_P3limBoss' .. index - 1], 'BOTTOM', 0, -6)
  581.         end
  582.  
  583.         local blizz = _G['Boss' .. index .. 'TargetFrame']
  584.         blizz:UnregisterAllEvents()
  585.         blizz:Hide()
  586.     end
  587. end)
RAW Paste Data