Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.54 KB | None | 0 0
  1. --oUF_Terenna
  2. local _, ns = ...
  3. local oUF = ns.oUF or oUF
  4.  
  5. --local FONT    = [=[Interface\AddOns\oUF_Terenna\Font.ttf]=]
  6. local FONT      = [=[Interface\AddOns\oUF_P3lim\pixel.ttf]=]
  7. local TEXTURE   = [=[Interface\ChatFrame\ChatFrameBackground]=]
  8. local BACKDROP  = {
  9.     bgFile = TEXTURE,
  10.     insets = {top = -1, bottom = -1, left = -1, right = -1}
  11. }
  12.  
  13. local PlayerBuffWhiteList = {
  14.     [2823]      = true, --deadly poison
  15.     [108211]    = true, --leeching poison
  16.     [3408]      = true, --crippling poison
  17.     [8679]      = true, --wound poison
  18.     [5171]      = true, --slice and dice
  19.     [84745]     = true, --shallow insight
  20.     [84746]     = true, --moderate insight
  21.     [84747]     = true, --deep insight
  22.     [1784]      = true, --stealth
  23.     [115191]    = true, --subterfuge stealth
  24.     [13877]     = true, --blade flurry
  25.     [13750]     = true, --adrenaline rush
  26.     [1966]      = true, --feint
  27.     [73651]     = true, --recuperate
  28.     [31224]     = true, --cloak of shadows
  29.     [80353]     = true, --time warp
  30.     [90355]     = true, --ancient hysteria
  31.     [2983]      = true, --sprint
  32.     [137573]    = true, --burst of speed
  33.     [54861]     = true, --nitro boosts
  34.     [36554]     = true, --shadowstep speed buff
  35.     [5277]      = true, --evasion
  36.     [74001]     = true, --combat readiness
  37.     [74002]     = true, --combat insight
  38.     [114018]    = true, --shroud of concealment
  39.     [32182]     = true, --heroism
  40.     [146555]    = true, --drums of rage
  41.     [32645]     = true, --envenom
  42.     [31665]     = true, --master of subtlety
  43.     [115192]    = true, --subterfuge
  44.     [51713]     = true  --shadowdance
  45. }
  46.  
  47. local Shared = function(self, unit)
  48.     -----------------------
  49.     --Create Parent Frame--
  50.     -----------------------
  51.     self:RegisterForClicks('AnyUp')
  52.     self:SetBackdrop(BACKDROP)
  53.     self:SetBackdropColor(0, 0, 0)
  54.     --party, raid, and boss will be taken care of in spawn I believe
  55.     if unit == 'player' or unit == 'target' then
  56.         self:SetSize(250, 32)
  57.     elseif unit == 'focus' or unit == 'pet' or unit == 'targettarget' then
  58.         self:SetSize(85, 32)
  59.     end
  60.     ----------------------
  61.     --Create Health Bars--
  62.     ----------------------
  63.     local Health = CreateFrame('StatusBar', nil, self)
  64.         Health:SetPoint('TOPLEFT')
  65.         Health:SetPoint('TOPRIGHT')
  66.         Health:SetStatusBarTexture(TEXTURE)
  67.         Health:SetStatusBarColor(0.2, 0.2, 0.2)
  68.         Health.frequentUpdates = true
  69.         self.Health = Health
  70.  
  71.     local HealthBG = Health:CreateTexture(nil, 'BORDER')
  72.         HealthBG:SetAllPoints()
  73.         HealthBG:SetTexture(.55, .1, .1)
  74.         self.HealthBG = HealthBG
  75.     ---------------------- 
  76.     --Create Absorb Bars--
  77.     ----------------------
  78.     if unit == 'player' or unit == 'target' or unit == 'party' then
  79.         local myBar = CreateFrame('StatusBar', nil, self.Health)
  80.             myBar:SetPoint('TOP')
  81.             myBar:SetPoint('BOTTOM')
  82.             myBar:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT')
  83.             myBar:SetWidth(self:GetWidth())
  84.             myBar:SetStatusBarColor(0, 0.7, 0, 1) --green for heals
  85.        
  86.         local absorbBar = CreateFrame('StatusBar', nil, self.Health)
  87.             absorbBar:SetPoint('TOP')
  88.             absorbBar:SetPoint('BOTTOM')
  89.             absorbBar:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT')
  90.             absorbBar:SetWidth(self:GetWidth())
  91.             absorbBar:SetStatusBarColor(0, 0, 0.7, 1) --blue for absorbs
  92.            
  93.         self.HealPrediction = {
  94.                 myBar   = myBar,
  95.                 absorbBar       = absorbBar,
  96.                 maxOverflow             = 1,
  97.                 frequentUpdates         = true
  98.             }
  99.     end
  100.     ---------------------
  101.     --Create Power Bars--
  102.     ---------------------
  103.     if unit == 'player' or unit == 'target' or unit == 'party' then
  104.         local Power = CreateFrame('StatusBar', nil, self)
  105.             Power:SetPoint('BOTTOMRIGHT')
  106.             Power:SetPoint('BOTTOMLEFT')
  107.             Power:SetPoint('TOP', Health, 'BOTTOM', 0, -1)
  108.             Power:SetStatusBarTexture(TEXTURE)
  109.             Power.frequentUpdates = true
  110.             Power.colorClass = true
  111.             self.Power = Power
  112.            
  113.         local PowerBG = Power:CreateTexture(nil, 'BORDER')
  114.             PowerBG:SetAllPoints()
  115.             PowerBG:SetTexture(TEXTURE)
  116.             PowerBG.multiplier = 0.5
  117.             Power.bg = PowerBG
  118.     end
  119.     --------------------
  120.     --Create Raid Icon--
  121.     --------------------
  122.     local RaidIcon = self.Health:CreateTexture(nil, 'OVERLAY')
  123.         RaidIcon:SetPoint('TOP', self, 'TOP', 0, 8)
  124.         RaidIcon:SetSize(16, 16)
  125.         self.RaidIcon = RaidIcon
  126.         if unit ~= 'party' and unit ~= 'raid' then
  127.             RaidIcon:SetPoint('TOP', self, 'TOP', 0, 8)
  128.         else
  129.             RaidIcon:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 2, 2)
  130.         end
  131.     ------------------------
  132.     --Create (De)Buff Bars--
  133.     ------------------------
  134.     if unit == 'player' or unit == 'target' or unit == 'focus' then
  135.         local BuffBars = CreateFrame('Frame', nil, self)
  136.             BuffBars.fontFile = FONT
  137.             self.BuffBars = BuffBars
  138.            
  139.         local DebuffBars = CreateFrame("Frame", nil , self)
  140.             DebuffBars.growDown = true
  141.             DebuffBars.fontFile = FONT
  142.             self.DebuffBars = DebuffBars
  143.     end
  144. end
  145.  
  146. local UnitSpecific = {
  147.     player = function(self, ...)
  148.         Shared(self, ...)
  149.        
  150.         self.Health:SetPoint('BOTTOM', 0, 3)
  151.         local HealthText = self.Health:CreateFontString(nil, 'OVERLAY')
  152.         HealthText:SetPoint('LEFT', self, 'RIGHT', 5, 3)
  153.         HealthText:SetFont(FONT, 10, 'OUTLINE')
  154.         self:Tag(HealthText, '[Terenna:healthtext]')
  155.        
  156.         local HealthPercentText = self.Health:CreateFontString(nil, 'OVERLAY')
  157.         HealthPercentText:SetPoint('RIGHT', self, 'LEFT', -5, 3)
  158.         HealthPercentText:SetFont(FONT, 10, 'OUTLINE')
  159.         self:Tag(HealthPercentText, '[Terenna:healthpercenttext]')
  160.        
  161.         local PowerText = self.Power:CreateFontString(nil, 'OVERLAY')
  162.         PowerText:SetPoint('LEFT', self, 'RIGHT', 5, -10)
  163.         PowerText:SetFont(FONT, 10, 'OUTLINE')
  164.         self:Tag(PowerText, '[Terenna:powertext]')
  165.        
  166.         local Assistant = self.Health:CreateTexture(nil, 'OVERLAY')
  167.         Assistant:SetSize(3, 8)
  168.         Assistant:SetPoint('TOPLEFT', self, 'TOPLEFT', 2, 0)
  169.         self.Assistant = Assistant
  170.        
  171.         local Combat = self.Health:CreateTexture(nil, 'OVERLAY')
  172.         Combat:SetSize(3, 8)
  173.         Combat:SetPoint('TOPLEFT', self, 'TOPLEFT', 7, 0)
  174.         self.Combat = Combat
  175.        
  176.         local Resting = self.Health:CreateTexture(nil, 'OVERLAY')
  177.         Resting:SetSize(3, 8)
  178.         Resting:SetPoint('TOPLEFT', self, 'TOPLEFT', 12, 0)
  179.         self.Resting = Resting
  180.         --------------------
  181.         --Player Buff Bars--
  182.         --------------------
  183.         self.BuffBars:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 17)
  184.         self.BuffBars:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', -20, 17)
  185.         self.BuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, casterUnit, _, _, spellID)
  186.             if casterUnit == 'vehicle' or PlayerBuffWhiteList[spellID] then
  187.                 return true
  188.             else
  189.                 return false
  190.             end
  191.         end
  192.         ----------------------
  193.         --Player Debuff Bars--
  194.         ----------------------
  195.         self.DebuffBars:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -100)
  196.         self.DebuffBars:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', -20, -100)
  197.         self.DebuffBars.dispelTypeColors = true
  198.         self.DebuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, _, _, _, spellID)
  199.             if spellID ~= 95223 then
  200.                 return true
  201.             end
  202.         end
  203.     end,
  204.     target = function(self, ...)
  205.         Shared(self, ...)
  206.        
  207.         self.Range = {
  208.             insideAlpha = 1,
  209.             outsideAlpha = 0.4
  210.         }
  211.        
  212.         self.Health:SetPoint('BOTTOM', 0, 3)
  213.         self.Health.colorTapping = true
  214.         self.Health.colorDisconnected = true
  215.         self.Health.colorHealth = true
  216.         self.colors.health[1], self.colors.health[2], self.colors.health[3] = 0.2, 0.2, 0.2
  217.        
  218.         self.Power.colorClassNPC = true
  219.         self.Power.colorClassPet = true
  220.        
  221.         local QuestIcon = self.Health:CreateFontString(nil, 'OVERLAY')
  222.         QuestIcon:SetPoint('CENTER', self, 'TOP')
  223.         QuestIcon:SetFont(FONT, 20, 'OUTLINE')
  224.         QuestIcon:SetTextColor(1, 1, 0)
  225.         self:Tag(QuestIcon, '[Terenna:questicon]')
  226.        
  227.         local HealthText = self.Health:CreateFontString(nil, 'OVERLAY')
  228.         HealthText:SetPoint('RIGHT', self, 'LEFT', -5, 3)
  229.         HealthText:SetFont(FONT, 10, 'OUTLINE')
  230.         self:Tag(HealthText, '[Terenna:targethealthtext]')
  231.        
  232.         local HealthPercentText = self.Health:CreateFontString(nil, 'OVERLAY')
  233.         HealthPercentText:SetPoint('LEFT', self, 'RIGHT', 5, 3)
  234.         HealthPercentText:SetFont(FONT, 10, 'OUTLINE')
  235.         self:Tag(HealthPercentText, '[Terenna:targethealthpercenttext]')
  236.        
  237.         local PowerText = self.Power:CreateFontString(nil, 'OVERLAY')
  238.         PowerText:SetPoint('RIGHT', self, 'LEFT', -5, -10)
  239.         PowerText:SetFont(FONT, 10, 'OUTLINE')
  240.         self:Tag(PowerText, '[Terenna:powertext]')
  241.        
  242.         local NameText = self:CreateFontString(nil, 'OVERLAY')
  243.         NameText:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -5)
  244.         NameText:SetFont(FONT, 10, 'OUTLINE')
  245.         self:Tag(NameText, '[Terenna:name]')
  246.     end
  247. }
  248.  
  249. oUF:RegisterStyle('oUF_Terenna_Player', UnitSpecific.player)
  250. oUF:SetActiveStyle('oUF_Terenna_Player')
  251. oUF:Spawn('player'):SetPoint('CENTER', -345, -36)
  252.  
  253. oUF:RegisterStyle('oUF_Terenna_Target', UnitSpecific.target)
  254. oUF:SetActiveStyle('oUF_Terenna_Target')
  255. oUF:Spawn('target'):SetPoint('CENTER', 345, -36)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement