daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --SETTINGS START
  2. --If you have questions regarding these settings, hit me up on Discord!
  3.  
  4. --can be changed to match the tooltip values instead of the amount actually absorbed by Ignore Pain
  5. aura_env.matchTooltip = false
  6.  
  7. --select what to display in the three available text fields.
  8. --the tokens between ## get replaced by values.
  9. --tokens available are:
  10. ---duration: total time of IP buff
  11. ---remaining: time left on IP buff
  12. ---curRage: current rage
  13. ---maxRage: maximum rage
  14. ---curIP: value of current IP buff
  15. ---maxIP: value of IP with maximum rage
  16. ---newIP: value of IP with current rage
  17. ---cap: total absorb cap of IP
  18. ---leftToCap: how much is left between curIP and the cap
  19. ---castIP: value of IP if cast right now (includes wasted absorb, can even be negative)
  20. ---curIPMaxHP: the current IP as a percentage of your maximum health
  21. aura_env.textLeft = "#curIP#"
  22. aura_env.textCenter = "#castIP#"
  23. aura_env.textRight = "#cap#"
  24.  
  25. --use this setting to select a theme from the presets below.
  26. --you can customize the presets by changing the values.
  27. --colors are hexadecimal in the format AARRGGBB.
  28. --google "color picker" if you want to know hex codes for colors.
  29. aura_env.preset = "DEFAULT"
  30. --SETTINGS END
  31.  
  32. --theme and presets
  33. aura_env.presets = {
  34.     ["CUSTOM"] = { -- you can edit your own colors in here, just copy them over when you get a new version.
  35.         ["colorCurIP"] = "ffffffff",
  36.         ["colorCurIPOverCap"] = "ffffffff",
  37.         ["colorCastIP"] = "ffffffff",
  38.         ["colorCastIPWaste"] = "ffffffff",
  39.         ["alwaysShowCastBar"] = false,
  40.         ["showTimeSpark"] = true,
  41.         ["textCenterFontName"] = "Fonts\\FRIZQT__.TTF",
  42.         ["textCenterFontSize"] = 18,
  43.         ["textCenterFontFlags"] = "",
  44.     },
  45.     ["MEGASUS"] = { -- orange theme, blue waste, and no over cap. Suggested by Megasus#0782
  46.         ["colorCurIP"] = "ffea6420",
  47.         ["colorCurIPOverCap"] = "ffea6420",
  48.         ["colorCastIP"] = "fff29b29",
  49.         ["colorCastIPWaste"] = "ff005dff",
  50.         ["alwaysShowCastBar"] = false,
  51.         ["showTimeSpark"] = true,
  52.         ["textCenterFontName"] = "Fonts\\FRIZQT__.TTF",
  53.         ["textCenterFontSize"] = 25,
  54.         ["textCenterFontFlags"] = "",
  55.     },
  56.     ["DEFAULT"] = { -- default orange/yellow theme, greenish waste, and red for over cap.
  57.         ["colorCurIP"] = "ffff9000",
  58.         ["colorCurIPOverCap"] = "ffff0000",
  59.         ["colorCastIP"] = "ffddff00",
  60.         ["colorCastIPWaste"] = "ff00ff99",
  61.         ["alwaysShowCastBar"] = false,
  62.         ["showTimeSpark"] = true,
  63.         ["textCenterFontName"] = "Fonts\\FRIZQT__.TTF",
  64.         ["textCenterFontSize"] = 18,
  65.         ["textCenterFontFlags"] = "",
  66.     },
  67. }
  68. aura_env.theme = {}
  69. if aura_env.preset then
  70.     local preset = aura_env.presets[aura_env.preset]
  71.     if not preset then
  72.         preset = aura_env.presets["DEFAULT"]
  73.     end
  74.     aura_env.theme = preset
  75. end
  76.  
  77.  
  78. --text replacement tokens
  79. aura_env.tokens = {
  80.     ["duration"] = function()
  81.         if aura_env.duration > 0 then
  82.             return string.format("%d", aura_env.duration)
  83.         else
  84.             return ""
  85.         end
  86.     end,
  87.     ["remaining"] = function()
  88.         if aura_env.expiration > 0 then
  89.             return string.format("%d", (aura_env.expiration-GetTime()))
  90.         else
  91.             return ""
  92.         end
  93.     end,
  94.     ["curRage"] = function()
  95.         return string.format("%d", aura_env.curRage)
  96.     end,
  97.     ["maxRage"] = function()
  98.         return string.format("%d", aura_env.maxRage)
  99.     end,
  100.     ["curIP"] = function()
  101.         return string.format("%s", aura_env.shortenNumber(aura_env.curIP))
  102.     end,
  103.     ["maxIP"] = function()
  104.         return string.format("%s", aura_env.shortenNumber(aura_env.maxIP))
  105.     end,
  106.     ["newIP"] = function()
  107.         return string.format("%s", aura_env.shortenNumber(aura_env.newIP))
  108.     end,
  109.     ["castIP"] = function()
  110.         return string.format("%s", aura_env.shortenNumber(aura_env.castIP))
  111.     end,
  112.     ["leftToCap"] = function()
  113.         return string.format("%s", aura_env.shortenNumber(aura_env.leftToCap))
  114.     end,
  115.     ["cap"] = function()
  116.         return string.format("%s", aura_env.shortenNumber(aura_env.cap))
  117.     end,
  118.     ["curIPMaxHP"] = function()
  119.         return string.format("%d", (aura_env.curIP/UnitHealthMax("player")*100))
  120.     end,
  121. }
  122. aura_env.replaceTokens = function(text)
  123.     local repl = function(token)
  124.         local f = aura_env.tokens[token]
  125.         if f and type(f) == "function" then
  126.             return f()
  127.         end
  128.         return token
  129.     end
  130.     local s = text:gsub("#(.-)#", repl)
  131.     return s
  132. end
  133.  
  134. --hex to rgb helper function
  135. aura_env.HexToRGB = function(hex)
  136.     local a,r,g,b = 1,1,1,1
  137.     if hex and type(hex) == "string" and strlen(hex) == 8 then
  138.         a = tonumber(hex:sub(1,2), 16)/255
  139.         r = tonumber(hex:sub(3,4), 16)/255
  140.         g = tonumber(hex:sub(5,6), 16)/255
  141.         b = tonumber(hex:sub(7,8), 16)/255
  142.     end
  143.     return r,g,b,a
  144. end
  145.  
  146. --init stuff
  147. aura_env.duration = 0
  148. aura_env.expiration = 0
  149. aura_env.curRage = 0
  150. aura_env.maxRage = 0
  151. aura_env.curIP = 0
  152. aura_env.maxIP = 0
  153. aura_env.newIP = 0
  154. aura_env.castIP = 0
  155. aura_env.cap = 0
  156. aura_env.leftToCap = 0
  157. aura_env.hasMinRage = false
  158.  
  159. --calculate IP values
  160. aura_env.updateIPValues = function()
  161.     --Rage
  162.     aura_env.curRage = UnitPower("player")
  163.     aura_env.maxRage = UnitPowerMax("player")
  164.     local costs = GetSpellPowerCost(190456)
  165.     local minRage = costs[1].minCost or 20
  166.     local maxRage = costs[1].cost or 60
  167.     local calcRage = math.max(minRage, math.min(maxRage, aura_env.curRage))
  168.    
  169.     if maxRage == 0 then
  170.         maxRage = 60
  171.     end
  172.    
  173.     aura_env.hasMinRage = aura_env.curRage > minRage
  174.    
  175.     --attack power
  176.     local apBase, apPos, apNeg = UnitAttackPower("player")
  177.    
  178.     --Versatility rating
  179.     local vers = 1 + ((GetCombatRatingBonus(29) + GetVersatilityBonus(30)) / 100)
  180.    
  181.     --Dragon Skin
  182.     --check artifact traits
  183.     local currentRank = 0
  184.     if IsAddOnLoaded("LibArtifactData-1.0") or LoadAddOn("LibArtifactData-1.0") then
  185.         aura_env.LAD = aura_env.LAD or LibStub("LibArtifactData-1.0")
  186.         if not aura_env.LAD:GetActiveArtifactID() then
  187.             aura_env.LAD:ForceUpdate()
  188.         end
  189.         --pos, traitid, spellid, name, icon, rank, max, bonus, gold, first, last
  190.         for _, _, spellid, name, _, rank in aura_env.LAD:IterateTraits() do
  191.             if spellid == 203225 then
  192.                 currentRank = rank
  193.                 break
  194.             end
  195.         end
  196.     end
  197.     local trait = 1 + 0.02 * currentRank
  198.    
  199.     --Dragon Scales
  200.     local scales = UnitBuff("player", GetSpellInfo(203581)) and 1.4 or 1
  201.    
  202.     --Never Surrender
  203.     local curHP = UnitHealth("player")
  204.     local maxHP = UnitHealthMax("player")
  205.     local misPerc = (maxHP - curHP) / maxHP
  206.     local nevSur = select(4, GetTalentInfo(5, 2, 1))
  207.     local nevSurPerc = nevSur and (1 + misPerc) or 1
  208.    
  209.     --Indomitable
  210.     local indom = select(4, GetTalentInfo(5, 3, 1)) and 1.2 or 1
  211.    
  212.     --T18
  213.     local t18 = UnitBuff("player", GetSpellInfo(12975)) and aura_env.GetNumSetPieces("T18") >= 4 and 2 or 1
  214.    
  215.    
  216.    
  217.     local ipvalues = {UnitBuff("player", GetSpellInfo(190456))}
  218.    
  219.     --ip duration
  220.     aura_env.duration, aura_env.expiration = ipvalues[6] or 0, ipvalues[7] or 0
  221.    
  222.     --current IP value
  223.     aura_env.curIP = ipvalues[17] or 0
  224.     if aura_env.matchTooltip then
  225.         aura_env.curIP = aura_env.curIP / 0.9 --get the tooltip value instead of the absorb
  226.     end
  227.    
  228.     --max IP with one cast
  229.     aura_env.maxIP = (apBase + apPos + apNeg) * 22.3 * vers * indom * scales
  230.     if not aura_env.matchTooltip then
  231.         aura_env.maxIP = aura_env.maxIP * 0.9
  232.     end
  233.    
  234.     --new IP with current rage
  235.     aura_env.newIP = aura_env.maxIP * (calcRage / maxRage) * trait * nevSurPerc * t18
  236.    
  237.     --cap
  238.     aura_env.cap = aura_env.maxIP * 3
  239.     if nevSur then
  240.         aura_env.cap = aura_env.cap * 2
  241.     end
  242.    
  243.     --how much left to cap
  244.     aura_env.leftToCap = aura_env.cap - aura_env.curIP
  245.    
  246.     --how much casting ip would give right now
  247.     aura_env.castIP = math.min(aura_env.leftToCap, aura_env.newIP)
  248. end
  249. aura_env.updateIPValues()
  250.  
  251. --shorten numbers to 3 digits
  252. aura_env.shortenNumber = function(number)
  253.     if type(number) ~= "number" then
  254.         number = tonumber(number)
  255.     end
  256.     if not number then
  257.         return
  258.     end
  259.    
  260.     local affixes = {
  261.         "",
  262.         "k",
  263.         "m",
  264.         "b",
  265.         "t",
  266.     }
  267.    
  268.     local affix = 1
  269.     local dec = 0
  270.     local num1 = math.abs(number)
  271.     while num1 >= 1000 and affix < #affixes do
  272.         num1 = num1 / 1000
  273.         affix = affix + 1
  274.     end
  275.     if affix > 1 then
  276.         dec = 2
  277.         local num2 = num1
  278.         while num2 >= 10 and dec > 0 do
  279.             num2 = num2 / 10
  280.             dec = dec - 1
  281.         end
  282.     end
  283.     if number < 0 then
  284.         num1 = -num1
  285.     end
  286.    
  287.     return string.format("%."..dec.."f"..affixes[affix], num1)
  288. end
  289.  
  290. --set bonuses
  291. aura_env.GetNumSetPieces = function(set, class)
  292.     class = class or select(2, UnitClass("player"))
  293.     local sets = aura_env.sets[class]
  294.     if not sets then
  295.         return -1
  296.     end
  297.     local pieces = sets[set]
  298.     if not pieces then
  299.         return -1
  300.     end
  301.     local counter = 0
  302.     for _, itemID in ipairs(pieces) do
  303.         if IsEquippedItem(itemID) then
  304.             counter = counter + 1
  305.         end
  306.     end
  307.     return counter
  308. end
  309. aura_env.sets = {
  310.     ["WARRIOR"] = {
  311.         ["T18"] = {
  312.             124319,
  313.             124329,
  314.             124334,
  315.             124340,
  316.             124346,
  317.         },
  318.     },
  319. }
  320.  
  321. --frame stuff--
  322. aura_env.orientation = WeakAuras.regions[aura_env.id].region.orientation
  323. if aura_env.orientation == "HORIZONTAL" then
  324.     aura_env.point = "LEFT"
  325.     aura_env.offsetXMulti = 1
  326.     aura_env.offsetYMulti = 0
  327.     aura_env.castPoint = "RIGHT"
  328. elseif aura_env.orientation == "HORIZONTAL_INVERSE" then
  329.     aura_env.point = "RIGHT"
  330.     aura_env.offsetXMulti = -1
  331.     aura_env.offsetYMulti = 0
  332.     aura_env.castPoint = "LEFT"
  333. elseif aura_env.orientation == "VERTICAL" then
  334.     aura_env.point = "TOP"
  335.     aura_env.offsetXMulti = 0
  336.     aura_env.offsetYMulti = -1
  337.     aura_env.castPoint = "BOTTOM"
  338. elseif aura_env.orientation == "VERTICAL_INVERSE" then
  339.     aura_env.point = "BOTTOM"
  340.     aura_env.offsetXMulti = 0
  341.     aura_env.offsetYMulti = 1
  342.     aura_env.castPoint = "TOP"
  343. end
  344.  
  345. local bar = WeakAuras.regions[aura_env.id].region.bar
  346.  
  347. --create castIP bar
  348. if bar.cast then bar.cast:Hide() end
  349. local cast = bar:CreateTexture(nil, "ARTWORK")
  350. cast:SetDrawLayer("ARTWORK", 3)
  351. cast:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White.tga")
  352. cast:SetBlendMode("ALPHAKEY")
  353. cast:SetVertexColor(1,1,1,0.3)
  354. if aura_env.orientation == "HORIZONTAL" or aura_env.orientation == "HORIZONTAL_INVERSE" then
  355.     cast:SetWidth(50)
  356.     cast:SetHeight(bar:GetHeight())
  357. elseif aura_env.orientation == "VERTICAL" or aura_env.orientation == "VERTICAL_INVERSE" then
  358.     cast:SetWidth(bar:GetWidth())
  359.     cast:SetHeight(50)
  360. end
  361. bar.cast = cast
  362.  
  363. --create timer spark
  364. if bar.sparkTime then bar.sparkTime:Hide() end
  365. local sparkTime = bar:CreateTexture(nil, "ARTWORK")
  366. sparkTime:SetDrawLayer("ARTWORK", 4)
  367. sparkTime:SetTexture(bar.spark:GetTexture())
  368. sparkTime:SetBlendMode(bar.spark:GetBlendMode())
  369. if aura_env.orientation == "HORIZONTAL" or aura_env.orientation == "HORIZONTAL_INVERSE" then
  370.     sparkTime:SetWidth(bar.spark:GetWidth())
  371.     sparkTime:SetHeight(bar.spark:GetHeight())
  372. elseif aura_env.orientation == "VERTICAL" or aura_env.orientation == "VERTICAL_INVERSE" then
  373.     sparkTime:SetWidth(bar.spark:GetHeight())
  374.     sparkTime:SetHeight(bar.spark:GetWidth())
  375. end
  376. bar.sparkTime = sparkTime
  377.  
  378. aura_env.rotateText = function(text)
  379.     if not text.rotated
  380.     and (aura_env.orientation == "VERTICAL"
  381.     or aura_env.orientation == "VERTICAL_INVERSE") then
  382.         text.animGroup = text.animGroup or text:CreateAnimationGroup()
  383.         text.animGroup.rotate = text.animGroup.rotate or text.animGroup:CreateAnimation("rotation")
  384.         text.animGroup.rotate:SetOrigin("CENTER", 0, 0);
  385.         text.animGroup.rotate:SetDegrees(90);
  386.         text.animGroup.rotate:SetDuration(0);
  387.         text.animGroup.rotate:SetEndDelay(2147483647);
  388.         text.animGroup:Play();
  389.         text.animGroup.rotate:SetSmoothProgress(1);
  390.         text.animGroup:Pause();    
  391.        
  392.         text.offset = -(text:GetStringHeight() / 2) + 2
  393.         text.rotated = true
  394.     end
  395. end
  396.  
  397. --create center text
  398. if bar.centerText then bar.centerText:Hide() end
  399. local text = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  400. text.offset = 0
  401. text.rotated = false
  402. text:SetWordWrap(false)
  403. bar.centerText = text
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top