Advertisement
Guest User

Untitled

a guest
Dec 11th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.67 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 incominghealsbar = CreateFrame('StatusBar', nil, self.Health)
  80.             incominghealsbar:SetPoint('TOP')
  81.             incominghealsbar:SetPoint('BOTTOM')
  82.             incominghealsbar:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT')
  83.             incominghealsbar:SetWidth(self:GetWidth())
  84.             incominghealsbar: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.             incominghealsbar    = 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 = 1/3
  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:SetHeight(29)
  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.         --Leader/Assist Texture--
  167.         -------------------------
  168.         local leaderassistframe = CreateFrame('Button', 'PlayerLeaderAssistFrame', self)
  169.             leaderassistframe:SetSize(3,8)
  170.             leaderassistframe:SetPoint('TOPLEFT', self, 'TOPLEFT', 2, 0)
  171.             leaderassistframe:RegisterEvent('GROUP_ROSTER_UPDATE')
  172.             leaderassistframe:RegisterEvent('PARTY_LEADER_CHANGED')
  173.             leaderassistframe:RegisterEvent('PLAYER_ENTERING_WORLD')
  174.            
  175.         local leaderassisttexture = leaderassistframe:CreateTexture('PlayerLeaderAssistTexture', 'OVERLAY')
  176.             --leaderassisttexture:SetTexture('Interface\AddOns\oUF_Terenna\Status_Texture', 'OVERLAY')
  177.             leaderassisttexture = leaderassistframe:CreateTexture('Interface\AddOns\oUF_P3lim\F1_StatusBox_Bar', 'OVERLAY')
  178.             leaderassisttexture:SetTexture(1, 1, 0)
  179.             leaderassisttexture:SetAllPoints(true)
  180.            
  181.         leaderassistframe:SetScript('OnEvent', function(self, event, unit)
  182.             if UnitIsGroupLeader('player') or UnitIsRaidOfficer('player') then
  183.                 leaderassisttexture:Show()
  184.             else
  185.                 leaderassisttexture:Hide()
  186.             end
  187.         end)
  188.         -------------------------
  189.         --Player Combat Texture--
  190.         -------------------------
  191.         local playercombatframe = CreateFrame('Button', 'PlayerCombatFrame', self)
  192.             playercombatframe:SetSize(3,8)
  193.             playercombatframe:SetPoint('TOPLEFT', self, 'TOPLEFT', 7,0)
  194.             playercombatframe:RegisterEvent('PLAYER_ENTERING_WORLD')
  195.             playercombatframe:RegisterEvent('PLAYER_REGEN_DISABLED')
  196.             playercombatframe:RegisterEvent('PLAYER_REGEN_ENABLED')
  197.        
  198.         local playercombattexture = playercombatframe:CreateTexture('PlayerCombatTexture', 'OVERLAY')
  199.             --playercombattexture:SetTexture('Interface\AddOns\oUF_Terenna\Status_Texture', 'OVERLAY')
  200.             playercombattexture:SetTexture('Interface\AddOns\oUF_P3lim\F1_StatusBox_Bar', 'OVERLAY')
  201.             playercombattexture:SetTexture(1,0,0)
  202.             playercombattexture:SetAllPoints(true)
  203.             playercombattexture:Hide()
  204.        
  205.         playercombatframe:SetScript('OnEvent', function(self, event, unit)
  206.             if event == 'PLAYER_REGEN_DISABLED' then
  207.                 playercombattexture:Show()
  208.             elseif event == 'PLAYER_REGEN_ENABLED' then
  209.                 playercombattexture:Hide()
  210.             elseif (event == 'PLAYER_ENTERING_WORLD' and UnitAffectingCombat('player')) then
  211.                 playercombattexture:Show()
  212.             end
  213.         end)
  214.         --------------------------
  215.         --Player Resting Texture--
  216.         --------------------------
  217.         local playerrestingframe = CreateFrame('Button', 'PlayerRestingFrame', self)
  218.             playerrestingframe:SetSize(3,8)
  219.             playerrestingframe:SetPoint('TOPLEFT', self, 'TOPLEFT', 12, 0)
  220.             playerrestingframe:RegisterEvent('PLAYER_ENTERING_WORLD')
  221.             playerrestingframe:RegisterEvent('PLAYER_UPDATE_RESTING')
  222.  
  223.         local playerrestingtexture = playerrestingframe:CreateTexture('PlayerRestingTexture', 'OVERLAY')
  224.             --playerrestingtexture:SetTexture('Interface\AddOns\oUF_Terenna\Status_Texture', 'OVERLAY')
  225.             playerrestingtexture:SetTexture('Interface\AddOns\oUF_P3lim\F1_StatusBox_Bar', 'OVERLAY')
  226.             playerrestingtexture:SetTexture(0.41, 0.8, 0.94)
  227.             playerrestingtexture:SetAllPoints(true)
  228.        
  229.         playerrestingframe:SetScript('OnEvent', function(self, event, unit)
  230.             if IsResting() then
  231.                 playerrestingtexture:Show()
  232.             else
  233.                 playerrestingtexture:Hide()
  234.             end
  235.         end)
  236.         --------------------
  237.         --Player Buff Bars--
  238.         --------------------
  239.         self.BuffBars:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 17)
  240.         self.BuffBars:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', -20, 17)
  241.         self.BuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, casterUnit, _, _, spellID, _, _, _, _, _)
  242.             if casterUnit == 'vehicle' or PlayerBuffWhiteList[spellID] then
  243.                 return true
  244.             else
  245.                 return false
  246.             end
  247.         end
  248.         ----------------------
  249.         --Player Debuff Bars--
  250.         ----------------------
  251.         self.DebuffBars:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -100)
  252.         self.DebuffBars:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', -20, -100)
  253.         self.DebuffBars.dispelTypeColors = true
  254.         self.DebuffBars.customFilter = function(_, _, _, _, _, _, _, _, _, _, _, _, spellID)
  255.             if spellID ~= 95223 then
  256.                 return true
  257.             end
  258.         end
  259.     end
  260. }
  261.  
  262. oUF:RegisterStyle('Terenna', Shared)
  263. oUF:RegisterStyle('oUF_Terenna_Player', UnitSpecific.player)
  264. oUF:SetActiveStyle('oUF_Terenna_Player')
  265. oUF:Spawn('player'):SetPoint('CENTER', -345, -36)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement