Guest User

Untitled

a guest
Jun 25th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.80 KB | None | 0 0
  1. local Opts = nibRunes_Cfg
  2.  
  3. local nRD = CreateFrame("Frame")
  4. local EventsRegistered
  5.  
  6. nibRunes_Cfg = {
  7.  
  8. -- Hide Blizzard's Rune Display
  9. hideblizzard = true,
  10.  
  11. -- Position Settings
  12. position = {
  13.     x = 0,                  -- Horizontal offset
  14.     y = 6,                  -- Vertical offset
  15.     anchor = "CENTER",          -- Position on screen. CENTER, RIGHT, LEFT, BOTTOM, BOTTOMRIGHT, BOTTOMLEFT, TOP, TOPRIGHT, TOPLEFT
  16.     parent = "Stuf.units.player",       -- Parent Frame
  17. },
  18.  
  19. -- Horizontal display
  20. horizontalrunes = true,
  21. horizontalstacked = true,           -- If HorizontalRunes and HorizontalStacked is true, then Runes will be horizontal and stack together in a horizontal line.
  22.  
  23. -- Frame Level
  24. framelevel = {
  25.     strata = "LOW",             -- BACKGROUND, LOW, MEDIUM, HIGH
  26.     level = 2,              -- 0 to 100
  27. },
  28.  
  29.  
  30. -- Appearance
  31. appearance = {
  32.     opacity = 1,                -- Transparency (0 to 1)
  33.     borderwidth = 1,            -- Width of the Rune borders
  34. },
  35.  
  36.  
  37. -- Runes
  38. runes = {
  39.  
  40.     -- Size
  41.     size = {
  42.         height = 34.1,          -- Height of the Rune bars
  43.         width = 1,          -- Width of the Rune bars
  44.         padding = 1,            -- Gap between the Rune bars
  45.     },
  46.    
  47.     -- Order
  48.     -- [Bar Number] = Rune
  49.     -- Ex: [1] = 1 means [Bar1] = Blood 1
  50.     -- 1,2 = Blood   3,4 = Unholy   5,6 = Frost
  51.     order = {      
  52.         [1] = 1,
  53.         [2] = 2,
  54.         [3] = 3,
  55.         [4] = 4,
  56.         [5] = 5,
  57.         [6] = 6,
  58.     },
  59.    
  60.     -- Colors
  61.     colors = {
  62.         -- Standard Rune colors
  63.         bright = {
  64.             [1] = {r = 0.9, g = 0.15, b = 0.15},    -- Blood
  65.             [2] = {r = 0.40, g = 0.9, b = 0.30},    -- Unholy
  66.             [3] = {r = 0, g = 0.7, b = 0.9},    -- Frost
  67.             [4] = {r = 0.50, g = 0.27, b = 0.68},   -- Death
  68.         },
  69.         -- How much darker should the Runes be when in cooldown (0 to 1: 1 being the same color as normal, 0 being black)
  70.         dimfactor = 1,
  71.     },
  72. },
  73.  
  74.  
  75. -- Combat Fader
  76. combatfader = {
  77.     enabled = true,             -- Enable the Combat Fader
  78.     opacity = {
  79.         incombat = 1,           -- Opacity In-Combat
  80.         harmtarget = 1,         -- Opacity with an Enemy target selected
  81.         hurt = 1,           -- Opacity when Runes are still changing / cooling down
  82.         outofcombat = 1,        -- Opacity Out-of-combat
  83.     },
  84. },
  85.  
  86. -- Rune Data
  87. local RUNETYPE_BLOOD = 1
  88. local RUNETYPE_UNHOLY = 2
  89. local RUNETYPE_FROST = 3
  90. local RUNETYPE_DEATH = 4
  91.  
  92. local gcdNextDuration = 0
  93. local gcdEnd = 0
  94.  
  95. local HR, HS = false, false
  96.  
  97. -- Combat Fader
  98. local CombatFader = CreateFrame("Frame")
  99. CombatFader.Status = ""
  100.  
  101. local FadeTime = 0.25
  102.  
  103. local RuneFull = {
  104.     [1] = true,
  105.     [2] = true,
  106.     [3] = true,
  107.     [4] = true,
  108.     [5] = true,
  109.     [6] = true,
  110. }
  111.  
  112. local RunesAreReady = true
  113.  
  114. ---- COMBAT FADER
  115. -- Fade frame
  116. function CombatFader.FadeIt(Frame, NewOpacity)
  117.     local CurrentOpacity = Frame:GetAlpha();
  118.     if NewOpacity > CurrentOpacity then
  119.         UIFrameFadeIn(Frame, FadeTime, CurrentOpacity, NewOpacity);
  120.     elseif NewOpacity < CurrentOpacity then
  121.         UIFrameFadeOut(Frame, FadeTime, CurrentOpacity, NewOpacity);
  122.     end
  123. end
  124.  
  125. -- Determine new opacity values for frames
  126. function CombatFader.FadeFrames()
  127.     local NewOpacity
  128.  
  129.     -- Retrieve Element's opacity/visibility for current status
  130.     NewOpacity = 1
  131.     if CombatFader.Status == "INCOMBAT" then
  132.         NewOpacity = Opts.combatfader.opacity.incombat
  133.     elseif CombatFader.Status == "HARMTARGET" then
  134.         NewOpacity = Opts.combatfader.opacity.harmtarget
  135.     elseif CombatFader.Status == "HURT" then
  136.         NewOpacity = Opts.combatfader.opacity.hurt
  137.     elseif CombatFader.Status == "OUTOFCOMBAT" then
  138.         NewOpacity = Opts.combatfader.opacity.outofcombat
  139.     end
  140.     CombatFader.FadeIt(nRD.Frames.Parent, NewOpacity)
  141. end
  142.  
  143. -- Update current status
  144. function CombatFader.UpdateStatus()
  145.     local OldStatus = CombatFader.Status
  146.     if UnitAffectingCombat("player") then
  147.         CombatFader.Status = "INCOMBAT";                -- InCombat - Priority 1
  148.     elseif UnitExists("target") and UnitCanAttack("player", "target") then
  149.         CombatFader.Status = "HARMTARGET";              -- HarmTarget - Priority 2
  150.     elseif not RunesAreReady then
  151.         CombatFader.Status = "HURT";                    -- Not Full - Priority 4
  152.     else
  153.         CombatFader.Status = "OUTOFCOMBAT";             -- OutOfCombat - Priority 5
  154.     end
  155.     if CombatFader.Status ~= OldStatus then CombatFader.FadeFrames() end       
  156. end
  157.  
  158. function CombatFader.PLAYER_ENTERING_WORLD()
  159.     CombatFader.Status = nil
  160.     CombatFader.UpdateStatus()
  161.     CombatFader.FadeFrames()
  162. end
  163.  
  164. function CombatFader.UpdateRuneStatus()
  165.     if Opts.combatfader.enabled then
  166.         if ( RuneFull[1] and RuneFull[2] and RuneFull[3] and RuneFull[4] and RuneFull[5] and RuneFull[6] ) then
  167.             RunesAreReady = true
  168.         else
  169.             RunesAreReady = false
  170.         end
  171.         CombatFader.UpdateStatus()
  172.         CombatFader.FadeFrames()
  173.     end
  174. end
  175.  
  176. function CombatFader.OptionsRefresh()
  177.     CombatFader.Status = nil
  178.     CombatFader.UpdateStatus()
  179. end
  180.  
  181. function CombatFader.UpdateEnabled()
  182.     if Opts.combatfader.enabled then
  183.         CombatFader:RegisterEvent("PLAYER_ENTERING_WORLD")
  184.         CombatFader:RegisterEvent("PLAYER_TARGET_CHANGED")
  185.         CombatFader:RegisterEvent("PLAYER_REGEN_ENABLED")
  186.         CombatFader:RegisterEvent("PLAYER_REGEN_DISABLED")
  187.         CombatFader:SetScript("OnEvent", CombatFader.UpdateStatus)
  188.        
  189.         CombatFader.Status = nil
  190.         CombatFader.UpdateRuneStatus()
  191.     else
  192.         CombatFader:UnregisterEvent("PLAYER_ENTERING_WORLD")
  193.         CombatFader:UnregisterEvent("PLAYER_TARGET_CHANGED")
  194.         CombatFader:UnregisterEvent("PLAYER_REGEN_ENABLED")
  195.         CombatFader:UnregisterEvent("PLAYER_REGEN_DISABLED")
  196.        
  197.         nRD.Frames.Parent:SetAlpha(1)
  198.     end
  199. end
  200.  
  201. ---- RUNES
  202. -- Events
  203. function nRD.OnUpdate()
  204.     local time = GetTime()
  205.    
  206.     if time > nRD.LastTime + 0.04 then  -- Update 25 times a second
  207.         -- Update Rune Bars
  208.         local RuneBar
  209.         local start, duration, runeReady
  210.         for rune = 1, 6 do
  211.             RuneBar = nRD.Frames.RuneBars[rune]
  212.             start, duration, runeReady = GetRuneCooldown(rune)
  213.  
  214.             if RuneBar ~= nil then
  215.                 if runeReady or UnitIsDead("player") or UnitIsGhost("player") then
  216.                     if ( Opts.combatfader.enabled and (not RuneFull[rune]) and (not RunesAreReady) ) then
  217.                         RuneFull[rune] = runeReady
  218.                         CombatFader.UpdateRuneStatus()
  219.                     end
  220.                    
  221.                     local BGSize = Opts.runes.size.height + Opts.appearance.borderwidth * 2
  222.                     if HR then RuneBar.StatusBarBG:SetWidth(BGSize) else RuneBar.StatusBarBG:SetHeight(BGSize) end
  223.                     RuneBar.BottomStatusBar:SetValue(1)
  224.                     RuneBar.TopStatusBar:SetValue(1)
  225.                 else
  226.                     if ( Opts.combatfader.enabled and (RuneFull[rune] or RunesAreReady) ) then
  227.                         RuneFull[rune] = runeReady
  228.                         CombatFader.UpdateRuneStatus()
  229.                     end
  230.                    
  231.                     local BGSize = ((Opts.runes.size.height) * ((time - start) / duration)) + (Opts.appearance.borderwidth * 2)
  232.                     if HR then RuneBar.StatusBarBG:SetWidth(BGSize) else RuneBar.StatusBarBG:SetHeight(BGSize) end
  233.                     RuneBar.BottomStatusBar:SetValue((time - start) / duration)
  234.                     RuneBar.TopStatusBar:SetValue(math.max((time - (start + duration - gcdNextDuration)) / gcdNextDuration, 0.0))
  235.                 end
  236.             end
  237.         end
  238.  
  239.         nRD.LastTime = time
  240.     end
  241. end
  242.  
  243. function nRD.RuneTextureUpdate(rune)
  244.     RuneBar = nRD.Frames.RuneBars[rune]
  245.     if not RuneBar then return end
  246.    
  247.     local RuneType = GetRuneType(rune)
  248.     if RuneType then
  249.         RuneBar.BottomStatusBar.bg:SetTexture(Opts.runes.colors.bright[RuneType].r * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RuneType].g * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RuneType].b * Opts.runes.colors.dimfactor)
  250.         RuneBar.TopStatusBar.bg:SetTexture(Opts.runes.colors.bright[RuneType].r, Opts.runes.colors.bright[RuneType].g, Opts.runes.colors.bright[RuneType].b)
  251.     end
  252. end
  253.  
  254. function nRD.UpdateRuneTextures()
  255.     for rune = 1, 6 do
  256.         nRD.RuneTextureUpdate(rune)
  257.     end
  258. end
  259.  
  260. local function Rune_TypeUpdate(event, rune)
  261.     if not rune or tonumber(rune) ~= rune or rune < 1 or rune > 6 then
  262.         return
  263.     end
  264.  
  265.     -- Update Rune colors
  266.     nRD.RuneTextureUpdate(rune, select(3, GetRuneCooldown(rune)))
  267. end
  268.  
  269. local function Rune_UpdateForm()
  270.     if GetShapeshiftForm() == 3 then
  271.         -- Unholy presence
  272.         gcdNextDuration = 1.0
  273.     else
  274.         -- Not unholy presence
  275.         gcdNextDuration = 1.5
  276.     end
  277. end
  278.  
  279. local function Rune_UpdateCooldown()
  280.     -- Update Global Cooldown
  281.     local gcdStart, gcdDuration, gcdIsEnabled = GetCompanionCooldown("CRITTER", 1)
  282.     gcdEnd = gcdIsEnabled and gcdDuration > 0 and gcdStart + gcdDuration or gcdEnd
  283. end
  284.  
  285. local function Rune_PlayerEnteringWorld()
  286.     -- Update rune colors
  287.     nRD.UpdateRuneTextures()
  288.  
  289.     -- Update GCD info
  290.     Rune_UpdateForm()
  291.     Rune_UpdateCooldown()
  292. end
  293.  
  294. local function RuneEvents(self, event, ...)
  295.     if event == "PLAYER_ENTERING_WORLD" then
  296.         Rune_PlayerEnteringWorld()
  297.     elseif event == "ACTIONBAR_UPDATE_COOLDOWN" then
  298.         Rune_UpdateCooldown()
  299.     elseif event == "UPDATE_SHAPESHIFT_FORM" then
  300.         Rune_UpdateForm()
  301.     elseif event == "RUNE_TYPE_UPDATE" then
  302.         Rune_TypeUpdate(event, ...)
  303.     end
  304. end
  305.  
  306. function nRD.SetupEvents()
  307.     if EventsRegistered then return end
  308.    
  309.     nRD.Frames.Parent:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
  310.     nRD.Frames.Parent:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
  311.     nRD.Frames.Parent:RegisterEvent("RUNE_TYPE_UPDATE")
  312.     nRD.Frames.Parent:RegisterEvent("PLAYER_ENTERING_WORLD")
  313.     nRD.Frames.Parent:SetScript("OnEvent", RuneEvents)
  314.    
  315.     -- Enable OnUpdate handler
  316.     nRD.LastTime = 0
  317.     nRD.Frames.Main:SetScript("OnUpdate", nRD.OnUpdate)
  318.    
  319.     EventsRegistered = true
  320. end
  321.  
  322. -- Settings Update
  323. function nRD.UpdateSettings()
  324.     local PF = _G[Opts.position.parent] or UIParent
  325.     nRD.Frames.Parent:SetParent(PF)
  326.     nRD.Frames.Parent:SetPoint(Opts.position.anchor, PF, Opts.position.anchor, Opts.position.x, Opts.position.y)
  327.     nRD.Frames.Parent:SetFrameStrata(Opts.framelevel.strata)
  328.     nRD.Frames.Parent:SetFrameLevel(Opts.framelevel.level)
  329.    
  330.     if HR and HS then
  331.         nRD.Frames.Parent:SetWidth(Opts.runes.size.height * 6 + Opts.runes.size.padding * 7)
  332.         nRD.Frames.Parent:SetHeight(Opts.runes.size.width + Opts.runes.size.padding * 2)
  333.     elseif HR and not HS then
  334.         nRD.Frames.Parent:SetWidth(Opts.runes.size.height + Opts.runes.size.padding * 2)
  335.         nRD.Frames.Parent:SetHeight(Opts.runes.size.width * 6 + Opts.runes.size.padding * 7)
  336.     else
  337.         nRD.Frames.Parent:SetHeight(Opts.runes.size.height + Opts.runes.size.padding * 2)
  338.         nRD.Frames.Parent:SetWidth(Opts.runes.size.width * 6 + Opts.runes.size.padding * 7)
  339.     end
  340.    
  341.     nRD.Frames.Main:SetAllPoints(nRD.Frames.Parent)
  342.     nRD.Frames.Main:SetAlpha(Opts.appearance.opacity)
  343.    
  344.     local RuneBar
  345.     for i = 1, 6 do
  346.         local CurRune = Opts.runes.order[i]
  347.         RuneBar = nRD.Frames.RuneBars[i]
  348.  
  349.         -- Create Rune Bar
  350.         RuneBar.frame:SetFrameStrata(Opts.framelevel.strata)
  351.         RuneBar.frame:SetFrameLevel(Opts.framelevel.level + 1)
  352.         if HR and HS then
  353.             RuneBar.frame:SetWidth(Opts.runes.size.height)
  354.             RuneBar.frame:SetHeight(Opts.runes.size.width)
  355.             RuneBar.frame:SetPoint("TOPLEFT", nRD.Frames.Main, "TOPLEFT", Opts.runes.size.padding + (CurRune - 1) * (Opts.runes.size.height + Opts.runes.size.padding), -Opts.runes.size.padding)
  356.         elseif HR and not HS then
  357.             RuneBar.frame:SetWidth(Opts.runes.size.height)
  358.             RuneBar.frame:SetHeight(Opts.runes.size.width)
  359.             RuneBar.frame:SetPoint("TOPLEFT", nRD.Frames.Main, "TOPLEFT", -Opts.runes.size.padding, Opts.runes.size.padding + (CurRune - 1) * (Opts.runes.size.width + Opts.runes.size.padding))
  360.         else
  361.             RuneBar.frame:SetHeight(Opts.runes.size.height)
  362.             RuneBar.frame:SetWidth(Opts.runes.size.width)
  363.             RuneBar.frame:SetPoint("TOPLEFT", nRD.Frames.Main, "TOPLEFT", Opts.runes.size.padding + (CurRune - 1) * (Opts.runes.size.width + Opts.runes.size.padding), -Opts.runes.size.padding)
  364.         end
  365.        
  366.         -- Status Bar BG (Border)
  367.         if HR then
  368.             RuneBar.StatusBarBG:SetPoint("LEFT", RuneBar.frame, "LEFT", -Opts.appearance.borderwidth, 0)
  369.         else
  370.             RuneBar.StatusBarBG:SetPoint("BOTTOM", RuneBar.frame, "BOTTOM", 0, -Opts.appearance.borderwidth)
  371.         end
  372.         RuneBar.StatusBarBG:SetHeight(RuneBar.frame:GetHeight() + Opts.appearance.borderwidth * 2)
  373.         RuneBar.StatusBarBG:SetWidth(RuneBar.frame:GetWidth() + Opts.appearance.borderwidth * 2)
  374.         RuneBar.StatusBarBG:SetTexture(0, 0, 0, 1)
  375.  
  376.         -- Bottom Status Bar
  377.         RuneBar.BottomStatusBar:SetFrameStrata(Opts.framelevel.strata)
  378.         RuneBar.BottomStatusBar:SetFrameLevel(RuneBar.frame:GetFrameLevel() + 1)
  379.         RuneBar.BottomStatusBar.bg:SetTexture(Opts.runes.colors.bright[RUNETYPE_BLOOD].r * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RUNETYPE_BLOOD].g * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RUNETYPE_BLOOD].b * Opts.runes.colors.dimfactor)
  380.  
  381.         -- Top Status Bar
  382.         RuneBar.TopStatusBar:SetFrameStrata(Opts.framelevel.strata)
  383.         RuneBar.TopStatusBar:SetFrameLevel(RuneBar.BottomStatusBar:GetFrameLevel() + 1)
  384.         RuneBar.TopStatusBar.bg:SetTexture(Opts.runes.colors.bright[RUNETYPE_BLOOD].r, Opts.runes.colors.bright[RUNETYPE_BLOOD].g, Opts.runes.colors.bright[RUNETYPE_BLOOD].b)
  385.     end
  386.    
  387.     nRD.UpdateRuneTextures()
  388. end
  389.  
  390. -- Frame Creation
  391. function nRD.CreateFrames()
  392.     if nRD.Frames then return end
  393.    
  394.     nRD.Frames = {}
  395.    
  396.     -- Parent frame
  397.     nRD.Frames.Parent = CreateFrame("Frame", "Runes", UIParent)
  398.    
  399.     -- Create main frame
  400.     nRD.Frames.Main = CreateFrame("Frame", nil, nRD.Frames.Parent)
  401.     nRD.Frames.Main:SetParent(nRD.Frames.Parent)
  402.    
  403.     -- Rune Bars
  404.     nRD.Frames.RuneBars = {}
  405.     local RuneBar
  406.     local SBO
  407.     if HR then SBO = "HORIZONTAL" else SBO = "VERTICAL" end
  408.     for i = 1, 6 do
  409.         nRD.Frames.RuneBars[i] = {}
  410.         RuneBar = nRD.Frames.RuneBars[i]
  411.  
  412.         -- Create Rune Bar
  413.         RuneBar.frame = CreateFrame("Frame", nil, nRD.Frames.Main)
  414.        
  415.         -- Status Bar BG (Border)
  416.         RuneBar.StatusBarBG = RuneBar.frame:CreateTexture()
  417.  
  418.         -- Rune Backdrop
  419.         local Backdrop = CreateFrame("Frame", nil, Runes)
  420.         Backdrop:SetFrameStrata("BACKGROUND")
  421.         Backdrop:SetHeight(3)
  422.         Backdrop:SetPoint("BOTTOMLEFT", 0, 0)
  423.         Backdrop:SetPoint("BOTTOMRIGHT", 0, 0)
  424.         Backdrop:SetBackdrop({
  425.             bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
  426.             edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
  427.             edgeSize = 1,
  428.         })
  429.         Backdrop:SetBackdropColor(0, 0, 0, .05)
  430.         Backdrop:SetBackdropBorderColor(0, 0, 0)
  431.  
  432.         -- Bottom Status Bar
  433.         RuneBar.BottomStatusBar = CreateFrame("StatusBar", nil, RuneBar.frame)
  434.         RuneBar.BottomStatusBar:SetOrientation(SBO)
  435.         RuneBar.BottomStatusBar:SetMinMaxValues(0, 1)
  436.         RuneBar.BottomStatusBar:SetValue(1)
  437.         RuneBar.BottomStatusBar:SetAllPoints(RuneBar.frame)
  438.  
  439.         RuneBar.BottomStatusBar.bg = RuneBar.BottomStatusBar:CreateTexture()
  440.         RuneBar.BottomStatusBar.bg:SetAllPoints()
  441.         RuneBar.BottomStatusBar.bg:SetTexture(Opts.runes.colors.bright[RUNETYPE_BLOOD].r * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RUNETYPE_BLOOD].g * Opts.runes.colors.dimfactor, Opts.runes.colors.bright[RUNETYPE_BLOOD].b * Opts.runes.colors.dimfactor)
  442.         RuneBar.BottomStatusBar:SetStatusBarTexture(RuneBar.BottomStatusBar.bg)
  443.  
  444.         -- Top Status Bar
  445.         RuneBar.TopStatusBar = CreateFrame("StatusBar", nil, RuneBar.frame)
  446.         RuneBar.TopStatusBar:SetOrientation(SBO)
  447.         RuneBar.TopStatusBar:SetMinMaxValues(0, 1)
  448.         RuneBar.TopStatusBar:SetValue(1)
  449.         RuneBar.TopStatusBar:SetAllPoints(RuneBar.frame)
  450.  
  451.         RuneBar.TopStatusBar.bg = RuneBar.TopStatusBar:CreateTexture()
  452.         RuneBar.TopStatusBar.bg:SetAllPoints()
  453.         RuneBar.TopStatusBar.bg:SetTexture(Opts.runes.colors.bright[RUNETYPE_BLOOD].r, Opts.runes.colors.bright[RUNETYPE_BLOOD].g, Opts.runes.colors.bright[RUNETYPE_BLOOD].b)
  454.         RuneBar.TopStatusBar:SetStatusBarTexture(RuneBar.TopStatusBar.bg)
  455.     end
  456. end
  457.  
  458. ---- CORE
  459. function nRD.RefreshMod()
  460.     nRD.UpdateSettings()
  461.     CombatFader.UpdateEnabled()
  462. end
  463.  
  464. ----
  465. function nRD.Enable()
  466.     -- Refresh
  467.     nRD.RefreshMod()
  468.    
  469.     -- Setup Events
  470.     nRD.SetupEvents()
  471.    
  472.     -- Disable default rune frame
  473.     if Opts.hideblizzard then
  474.         RuneFrame:UnregisterAllEvents()
  475.         RuneFrame:Hide()
  476.         RuneFrame.Show = function() end
  477.     end
  478.    
  479.     -- Show RuneDisplay
  480.     nRD.Frames.Parent:Show()
  481. end
  482.  
  483. function nRD.PLAYER_LOGIN()
  484.     if not (select(2, UnitClass("player")) == "DEATHKNIGHT") then return end
  485.    
  486.     if Opts.horizontalrunes then HR = true end
  487.     if Opts.horizontalstacked then HS = true end
  488.    
  489.     nRD.CreateFrames()
  490.     nRD.Enable()
  491. end
  492.  
  493. local function EventHandler(self, event, ...)
  494.     if event == "PLAYER_LOGIN" then
  495.         nRD.PLAYER_LOGIN()
  496.     end
  497. end
  498. nRD:RegisterEvent("PLAYER_LOGIN")
  499. nRD:RegisterEvent("UNIT_HEALTH")
  500. nRD:SetScript("OnEvent", EventHandler)
Add Comment
Please, Sign In to add comment