Advertisement
Kygo

Frames as of 10/8-14

Aug 10th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.43 KB | None | 0 0
  1. --[[-----------------------------------------------------------
  2.     oUF_Kygo
  3.     PvE oriented oUF layout.
  4.     Modifications and edits are allowed to be uploaded to http://www.wowinterface.com
  5.    
  6. ---------------------------------------------------------------]]
  7.  
  8.  
  9. --Some Tags
  10. oUF.Tags.Events["shorthp"] = "UNIT_HEALTH"
  11. oUF.Tags.Methods["shorthp"] = function(unit)
  12.     if not UnitIsDeadOrGhost(unit) then
  13.         local hp = UnitHealth(unit)
  14.         return AbbreviateLargeNumbers(hp)
  15.     end
  16. end
  17.  
  18. oUF.Tags.Events["shortpp"] = "UNIT_POWER"
  19. oUF.Tags.Methods["shortpp"] = function(unit)
  20.     if not UnitIsDeadOrGhost(unit) then
  21.         local pp = UnitPower(unit)
  22.         return AbbreviateLargeNumbers(pp)
  23.     end
  24. end
  25.  
  26. oUF.Tags.Events["shortname"] = "UNIT_NAME"
  27. oUF.Tags.Methods["shortname"] = function(unit)
  28.     local name = UnitName(unit)
  29.     return string.sub(UnitName(unit), 1, 20)
  30. end
  31.  
  32. oUF.Tags.Events["readycheckicon"] = "DoReadyCheck"
  33. oUF.Tags.SharedEvents["IsInGroup"] = true
  34. oUF.Tags.Methods["readycheckicon"] = function(unit)
  35.     if unit == "player" and IsInGroup() then
  36.         return [[|Interface\\AddOns\\oUF_Kygo\\Media\\CPoint|t]]
  37.     end
  38. end
  39.  
  40. oUF.Tags.Events["rsicon"] = "PLAYER_UPDATE_RESTING"
  41. oUF.Tags.SharedEvents["PLAYER_UPDATE_RESTING"] = true
  42. oUF.Tags.Methods["rsicon"] = function(unit)
  43.     if unit == "player" and IsResting() then
  44.         return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:-6:64:64:28:6:6:28|t]]
  45.     end
  46. end
  47. oUF.Tags.Events["combaticon"] = "PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED"
  48. oUF.Tags.SharedEvents["PLAYER_REGEN_DISABLED"] = true
  49. oUF.Tags.SharedEvents["PLAYER_REGEN_ENABLED"] = true
  50. oUF.Tags.Methods["combaticon"] = function(unit)
  51.     if unit == "player" and UnitAffectingCombat("player") then
  52.         return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:0:64:64:37:58:5:26|t]]
  53.     end
  54. end
  55.  
  56. oUF.Tags.Events["licon"] = "GROUP_ROSTER_UPDATE"
  57. oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  58. oUF.Tags.Methods["licon"] = function(unit)
  59.     if UnitIsGroupLeader(unit) then
  60.         return [[|TInterface\GroupFrame\UI-Group-LeaderIcon:0|t]]
  61.     elseif UnitInRaid(unit) and UnitIsGroupAssistant(unit) then
  62.         return [[|TInterface\GroupFrame\UI-Group-AssistantIcon:0|t]]
  63.     end
  64. end
  65.  
  66. oUF.Tags.Events["mastericon"] = "PARTY_LOOT_METHOD_CHANGED GROUP_ROSTER_UPDATE"
  67. oUF.Tags.SharedEvents["PARTY_LOOT_METHOD_CHANGED"] = true
  68. oUF.Tags.SharedEvents["GROUP_ROSTER_UPDATE"] = true
  69. oUF.Tags.Methods["mastericon"] = function(unit)
  70.     local method, pid, rid = GetLootMethod()
  71.     if method ~= "master" then return end
  72.     local munit
  73.     if pid then
  74.         if pid == 0 then
  75.             munit = "player"
  76.         else
  77.             munit = "party" .. pid
  78.         end
  79.     elseif rid then
  80.         munit = "raid" .. rid
  81.     end
  82.     if munit and UnitIsUnit(munit, unit) then
  83.         return [[|TInterface\GroupFrame\UI-Group-MasterLooter:0:0:0:2|t]]
  84.     end
  85. end
  86.  
  87. -- Aura Bars
  88. local BUFF_HEIGHT = 20
  89. local function bar_OnUpdate(frame, elapsed)
  90.     local t = frame.timeLeft - elapsed
  91.     frame:SetValue(t > 0 and t or 0)
  92.     frame.timeLeft = t
  93. end
  94.  
  95. local function auras_PostCreateIcon(frame, icon)
  96.     local frame = frame.__owner
  97.    
  98.     local bar = CreateFrame("StatusBar", nil, icon)
  99.     bar:SetPoint("LEFT", icon, "RIGHT")
  100.     bar:SetWidth(frame:GetWidth() - BUFF_HEIGHT)
  101.     bar:SetHeight(BUFF_HEIGHT)
  102.     bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
  103.     bar:SetStatusBarColor(0, 0.6, 0)
  104.  
  105.     local bg = bar:CreateTexture(nil, "BACKGROUND")
  106.     bg:SetAllPoints(true)
  107.     bg:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
  108.     bg:SetVertexColor(0, 0.2, 0)
  109.     bar.bg = bg
  110.  
  111.     bar.timeLeft = 0
  112.     icon.bar = bar
  113. end
  114. --
  115.  
  116. local function Portrait_PostUpdate(portrait, unit)
  117.     portrait:SetCamera(0)
  118. end
  119.  
  120.  
  121. local function Style(frame, unit, isSingle)
  122.     frame:SetSize(150, 35)
  123.    
  124.     frame:RegisterForClicks("AnyUp")
  125.  
  126.     frame:SetScript("OnEnter", UnitFrame_OnEnter)
  127.     frame:SetScript("OnLeave", UnitFrame_OnLeave)
  128.  
  129.  
  130.     -----------------------------------
  131.     --  Frame background and border  --
  132.     -----------------------------------
  133.     frame:SetBackdrop({
  134.             bgFile = "Interface\\AddOns\\oUF_Kygo\\Media\\backdrop", tile = false,
  135.             edgeFile = "Interface\\AddOns\\oUF_Kygo\\Media\\backdrop_edge", edgeSize = 5,
  136.             insets = { left = 1, right = 1 , top = 1, bottom = 1 }
  137.     })
  138.     frame:SetBackdropColor(0, 0, 0, .1)
  139.     frame:SetBackdropBorderColor(0, 0, 0, 1)
  140.        
  141.  
  142.        
  143.     -----------------------------------
  144.     --           Health bar          --
  145.     -----------------------------------
  146.     local health = CreateFrame("StatusBar", nil, frame)
  147.     health:SetPoint("TOPLEFT", frame, 5, -5)
  148.     health:SetPoint("TOPRIGHT", frame, -5, 5)
  149.     health:SetHeight(20)
  150.  
  151.    
  152.     -- Health bar background
  153.     local healthBG = health:CreateTexture(nil, "BACKGROUND")
  154.     healthBG:SetAllPoints()
  155.     healthBG:SetTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
  156.     health.bg = healthBG   
  157.    
  158.    
  159.     -- Health bar colors
  160.     health:SetStatusBarTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
  161.     health:SetStatusBarColor(0.2, 0.2, 0.2) -- foreground color
  162.     health.bg:SetVertexColor(0.2, 0, 0) --background color
  163.    
  164.    
  165.     --Health bar text
  166.     local healthText = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  167.     healthText:SetPoint("RIGHT", health, "RIGHT")
  168.     healthText:SetTextColor(1, 1, 1, 1)
  169.     healthText:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  170.     frame:Tag(healthText, "[dead][shorthp]")
  171.    
  172.    
  173.     -- % HP on target and target of target
  174.     if unit == "target" or unit == "targettarget" then
  175.     local healthPer = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  176.     healthPer:SetPoint("LEFT", health, "LEFT", 2, 0)
  177.     healthPer:SetTextColor(1, 1, 1, 1)
  178.     healthPer:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 6)
  179.     frame:Tag(healthPer, "[perhp]")
  180.     end
  181.        
  182.        
  183.     frame.Health = health
  184.        
  185.        
  186.     -----------------------------------
  187.     --           Power bar           --
  188.     -----------------------------------
  189.     local power = CreateFrame("StatusBar", nil, frame)
  190.     power:SetPoint("TOPLEFT", health, "BOTTOMLEFT")
  191.     power:SetPoint("TOPRIGHT", health, "BOTTOMRIGHT")
  192.     power:SetPoint("BOTTOM", frame, 0, 5)
  193.    
  194.    
  195.     --Power background
  196.     local powerBG = power:CreateTexture(nil, "BACKGROUND")
  197.     powerBG:SetAllPoints()
  198.     powerBG:SetTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
  199.     power:SetStatusBarTexture("Interface\\AddOns\\oUF_Kygo\\Media\\Neal")
  200.     powerBG.multiplier = 0.3
  201.     power.bg = powerBG
  202.    
  203.    
  204.     --Power Text
  205.     local powerText = power:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  206.     powerText:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 6)
  207.     powerText:SetPoint("RIGHT", power, "RIGHT")
  208.     powerText:SetTextColor(1, 1, 1, 1)
  209.     frame:Tag(powerText, "[shortpp]")
  210.        
  211.        
  212.     power.colorPower = true
  213.     frame.Power = power
  214.    
  215.  
  216.     ---------------------------------
  217.     --            Name text        --
  218.     ---------------------------------
  219.     if unit == "target" or unit == "targettarget" or unit == "focus" or unit == "boss1" then
  220.     local name = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  221.     name:SetPoint("LEFT", frame, 5, -22)
  222.     name:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  223.     name:SetTextColor(1, 1, 1, 1)
  224.     frame:Tag(name, "[raidcolor][shortname]")
  225.     end
  226.    
  227.     ---------------------------------
  228.     --Level and classification text--
  229.     ---------------------------------
  230.     local level = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  231.     level:SetPoint("RIGHT", frame, "RIGHT", -5, -22)
  232.     level:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  233.     level:SetTextColor(1, 1, 1, 1)
  234.     frame:Tag(level, "[smartlevel][shortclassification]")
  235.    
  236.     --------------------------------
  237.     --             Misc           --
  238.     --------------------------------
  239.     local resting = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  240.     resting:SetPoint("TOPLEFT", frame)
  241.     resting:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  242.     frame:Tag(resting, "[rsicon]")
  243.    
  244.     local master = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  245.     master:SetPoint("TOPLEFT", frame, "TOPRIGHT", -15, 0)
  246.     master:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  247.     frame:Tag(master, "[mastericon]")
  248.    
  249.     local combaticon = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  250.     combaticon:SetPoint("TOPLEFT", frame)
  251.     combaticon:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  252.     frame:Tag(combaticon, "[combaticon]")
  253.    
  254.     local readycheckicon = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  255.     readycheckicon:SetPoint("CENTER", frame)
  256.     readycheckicon:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  257.     frame.Tag(readycheckicon, "[readycheckicon]")
  258.    
  259.     local licon = health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  260.     licon:SetPoint("TOPLEFT", frame)
  261.     licon:SetFont("Interface\\AddOns\\oUF_Kygo\\Media\\neuropol.ttf", 10)
  262.     frame.Tag(licon, "[licon]")
  263.    
  264.     --------------------------------
  265.     --          Portrait          --
  266.     --------------------------------
  267.     if unit == "player" or unit == "target" then
  268.         local portrait = CreateFrame("PlayerModel", nil, frame)
  269.         portrait:SetWidth(50)
  270.         portrait:SetAlpha(0.8)
  271.         if unit == "player" then
  272.             portrait:SetPoint("TOPRIGHT", frame, "TOPLEFT")
  273.             portrait:SetPoint("BOTTOMRIGHT", frame, "BOTTOMLEFT")
  274.         else
  275.             portrait:SetPoint("TOPLEFT", frame, "TOPRIGHT")
  276.             portrait:SetPoint("BOTTOMLEFT", frame, "BOTTOMRIGHT")
  277.         end
  278.    
  279.     frame.Portrait = portrait
  280.     end
  281.    
  282.    
  283.     ---------------------------------  
  284.     --        Combo Points         --
  285.     ---------------------------------
  286.     if unit == "target" then
  287.             local CPoints = {}
  288.  
  289.             for index = 1, MAX_COMBO_POINTS do
  290.                     local CPoint = health:CreateTexture(nil, "OVERLAY")
  291.                     -- Position and size of the combo point.
  292.                     CPoint:SetSize(10, 10)
  293.                     CPoint:SetPoint("LEFT", health, "LEFT", index * CPoint:GetWidth(), 0, 20)
  294.                     CPoint:SetTexture("Interface\\AddOns\\oUF_Kygo\\Media\\CPoint")
  295.                     CPoints[index] = CPoint
  296.             end
  297.  
  298.             frame.CPoints = CPoints
  299.                    
  300.     end
  301.    
  302.     ---------------------------------
  303.     --          Aurabars           --
  304.     ---------------------------------
  305.     if unit == "player" or unit == "target" then
  306.    
  307.  
  308.     local Auras = CreateFrame("Frame", nil, frame)
  309.     Auras:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 10)
  310.     Auras:SetWidth(BUFF_HEIGHT) -- no, Width/HEIGHT is not a mistake
  311.  
  312.     Auras["initialAnchor"] = "BOTTOMLEFT"
  313.     Auras["growth-y"] = "UP"
  314.     Auras["spacing-y"] = 1 -- 1px gap between bars, adjust as desired
  315.     Auras["num"] = 10 -- limit to showing 5 bars, adjust as desired
  316.     Auras["size"] = BUFF_HEIGHT
  317.  
  318.     Auras.PostCreateIcon = auras_PostCreateIcon
  319.    
  320.     if unit == "player" then
  321.         function Auras:CustomFilter(unit, icon, name, rank, texture, count, debuffType, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff)
  322.             if duration < 30 then
  323.                 icon.bar.timeLeft = timeLeft
  324.                 icon.bar:SetMinMaxValues(0, duration)
  325.                 icon.bar:SetValue(timeLeft)
  326.                 return true
  327.             end
  328.         end
  329.         frame.Buffs = Auras
  330.     elseif unit == "target" then
  331.         function Auras:CustomFilter(unit, icon, name, rank, texture, count, debuffType, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff)
  332.             if canApplyAura then
  333.                 icon.bar.timeLeft = timeLeft
  334.                 icon.bar:SetMinMaxValues(0, duration)
  335.                 icon.bar:SetValue(timeLeft)
  336.                 return true
  337.             end
  338.         end
  339.         frame.Debuffs = Auras
  340.     end
  341.     end
  342.    
  343.     --------------------------------
  344.     --       Misc PvE Stuff       --
  345.     --------------------------------
  346.     local RaidRole = frame:CreateTexture(nil, "OVERLAY")
  347.     RaidRole:SetSize(16, 16)
  348.     RaidRole:SetPoint("TOPLEFT")
  349.     frame.RaidRole = RaidRole
  350.    
  351.     local ReadyCheck = frame:CreateTexture(nil, "OVERLAY")
  352.     ReadyCheck:SetTexture("Interface\\AddOns\\oUF_Kygo\\Media\\CPoint")
  353.     ReadyCheck:SetSize(16, 16)
  354.     ReadyCheck:SetPoint("CENTER")
  355.     ReadyCheck.finishedTime = 10
  356.     ReadyCheck.fadeTime = 2
  357.     frame.ReadyCheck = ReadyCheck
  358.    
  359.    
  360. end
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367. oUF:RegisterStyle("Kygo", Style)
  368. oUF:SetActiveStyle("Kygo")
  369. --Spawning units!
  370. local player = oUF:Spawn("player")
  371. player:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  372.  
  373. local target = oUF:Spawn("target")
  374. target:SetPoint("LEFT", player, "RIGHT", 20, 0)
  375.  
  376. local pet = oUF:Spawn("pet")
  377. pet:SetPoint("BOTTOMLEFT", player, "TOPLEFT", 0, 20)
  378.  
  379. local tot = oUF:Spawn("targettarget")
  380. tot:SetPoint("BOTTOMLEFT", target, "TOPLEFT", 0, 20)
  381.  
  382. local focus = oUF:Spawn("focus")
  383. focus:SetPoint("CENTER", player, "CENTER", 0, 40)
  384.  
  385. local boss1 = oUF:Spawn("boss1")
  386. boss1:SetPoint("CENTER", player, "CENTER", 0, 70)
  387.  
  388. local party1 = oUF:Spawn("party1")
  389. party1:SetPoint("CENTER", player, "CENTER", 0, 110)
  390.  
  391. local party2 = oUF:Spawn("party2")
  392. party2:SetPoint("CENTER", player, "CENTER", 0, 150)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement