Advertisement
Guest User

mateescu

a guest
Jul 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. --------------------------------------------
  2. -- SOUL SHARDS BAR --
  3. -- Made by Kirihn-Area 52 --
  4. -- "The headless pigmy has terrible aim." --
  5. --------------------------------------------
  6.  
  7. --SHARDS DISPLAY
  8. aura_env.TrackDoom = true --Read bellow
  9. aura_env.DisplayEmptyShards = true
  10. aura_env.Spacing = 3 --How much space between shards
  11.  
  12. --[[
  13. If TrackDoom is enabled, Doom timers will show up on the bars,
  14. and the shard count display for Demonology will be hidden.
  15. If you have suggestions for better managing the display of
  16. both numbers, please let me know.
  17.  
  18. You can change the way Doom timers look by changing how Right
  19. Text looks like.
  20. ]]--
  21.  
  22. --SHARDS COLORS
  23. --Provide hex values
  24. local Affliction = {
  25. Base = "d7b3ff",
  26. Full = "ffba48",
  27. Spend = "ffba48"
  28. }
  29. local Demonology = {
  30. Base = "d7b3ff",
  31. Full = "ffba48",
  32. Spend = "ffba48",
  33. Doom = "600070"
  34. }
  35. local Destruction = {
  36. Base = "d7b3ff",
  37. Full = "ffba48",
  38. Spend = "ffba48"
  39. }
  40. local Xoroth = {--Only works when in Destruction spec
  41. Base = "d7b3ff",
  42. Full = "ffba48",
  43. Spend = "ffba48"
  44. }
  45.  
  46. --SHARDS COUNT
  47. local ShardCountOnMiddle = true --Read bellow.
  48. local DisplayModes = { --Read bellow.
  49. Affliction = "simple",
  50. Demonology = "simple",
  51. Destruction = "simple"
  52. }
  53. local Prediction = {--What happens to the count when you are casting a spell that consumes shards.
  54. Enabled = true, --If false, everything else is ignored.
  55. Color = "ff3200", --Use a hex code. This will also color partial Doom ticks.
  56. Text = "" --Text that will encapsulate the count. Read bellow for more information.
  57. }
  58.  
  59. --[[
  60. ShardCountOnMiddle -> If false, will make the count appear on the latest shard.
  61. If true, empty shards are hidden, and you have fewer than 3 shards; the count will display on the latest shard.
  62.  
  63. DisplayModes -> If "simple", displays the count as '3' and '3.5'.
  64. If "full", displays the count as '3.0' and '3.5'.
  65. If "tens", displays the count as '30' and '35'.
  66. If false, will hide the display.
  67.  
  68. Prediction.Text -> Brackets - such as {}, [], (), <>, and <<>> - will be correctly mirrored.
  69. For \, use "\\". For ", use '"' (single - double - single), and vice-versa.
  70. An empty string - i.e., inputing "" - is acceptable.
  71. Other unlisted characters will be used as is.
  72. ]]--
  73.  
  74. --------------------------------
  75. --No touchrino from here forward
  76. --------------------------------
  77. aura_env.cost = 0
  78. aura_env.consuming = 0
  79.  
  80. local display, spec = false, GetSpecialization()
  81. local brackets = {
  82. ["{"] = "}",
  83. ["}"] = "{",
  84. ["["] = "]",
  85. ["]"] = "[",
  86. ["("] = ")",
  87. [")"] = "(",
  88. ["<"] = ">",
  89. [">"] = "<",
  90. ["<<"] = ">>",
  91. [">>"] = "<<",
  92. }
  93.  
  94. function aura_env.AdjustToSpec(specialization)
  95. local function HexToRGBPerc(hex)
  96. local string, tonumber = string, tonumber
  97. local rhex, ghex, bhex = string.sub(hex, 1, 2), string.sub(hex, 3, 4), string.sub(hex, 5, 6)
  98.  
  99. return {r = tonumber(rhex, 16)/255, g = tonumber(ghex, 16)/255, b = tonumber(bhex, 16)/255}
  100. end
  101.  
  102. local p = {"Base", "Full", "Spend"}
  103. spec = specialization
  104.  
  105. if spec == 1 then
  106. display = DisplayModes.Affliction
  107. p.Base = HexToRGBPerc(Affliction.Base)
  108. p.Full = HexToRGBPerc(Affliction.Full)
  109. p.Spend = HexToRGBPerc(Affliction.Spend)
  110. elseif spec == 2 then
  111. if aura_env.TrackDoom then
  112. display = not IsPlayerSpell(265412) and DisplayModes.Demonology
  113. else
  114. display = DisplayModes.Demonology
  115. end
  116. p.Base = HexToRGBPerc(Demonology.Base)
  117. p.Full = HexToRGBPerc(Demonology.Full)
  118. p.Spend = HexToRGBPerc(Demonology.Spend)
  119. p.Doom = HexToRGBPerc(Demonology.Doom)
  120. p.Partial = HexToRGBPerc(Prediction.Color)
  121. elseif spec == 3 then
  122. display = DisplayModes.Destruction
  123. if IsPlayerSpell(101508) then
  124. p.Base = HexToRGBPerc(Xoroth.Base)
  125. p.Full = HexToRGBPerc(Xoroth.Full)
  126. p.Spend = HexToRGBPerc(Xoroth.Spend)
  127. else
  128. p.Base = HexToRGBPerc(Destruction.Base)
  129. p.Full = HexToRGBPerc(Destruction.Full)
  130. p.Spend = HexToRGBPerc(Destruction.Spend)
  131. end
  132. end
  133.  
  134. aura_env.Pallete = p
  135. end
  136.  
  137. aura_env.AdjustToSpec(spec)
  138.  
  139. function aura_env.FormatCount(pos, shards, consumed)
  140. if display then
  141. local match = ShardCountOnMiddle and 3 or math.floor(shards - 0.1) + 1
  142.  
  143. if not aura_env.DisplayEmptyShards and ShardCountOnMiddle and shards <= 2 then
  144. match = shards
  145. end
  146.  
  147. if pos == (match or math.floor(match - 0.1) + 1) then
  148. consumed = Prediction.Enabled and consumed or 0
  149. consumed = shards > consumed and consumed or shards
  150.  
  151. if display == "simple" then
  152. shards = shards - consumed
  153. elseif display == "full" then
  154. shards = string.format("%.1f", shards - consumed)
  155. if shards == "0.0" then shards = 0 end
  156. elseif display == "tens" then
  157. shards = (shards - consumed)*10
  158. else
  159. return ""
  160. end
  161.  
  162. if Prediction.Enabled and consumed > 0 then
  163. local open, close = Prediction.Text, brackets[Prediction.Text] or Prediction.Text
  164. shards = "|cff"..Prediction.Color..open..shards..close.."|r"
  165. end
  166.  
  167. return shards
  168. else
  169. return ""
  170. end
  171. else
  172. return ""
  173. end
  174. end
  175.  
  176. aura_env.Doom = aura_env.Doom or {}
  177. aura_env.format = string.format
  178.  
  179. function aura_env.nextDoom(dest1, dest2)
  180. return aura_env.Doom[dest1].exp < aura_env.Doom[dest2].exp
  181. end
  182.  
  183. --I do not understand this
  184. local function orderednext(t, n)
  185. local key = t[t.__next]
  186.  
  187. if not key then return end
  188.  
  189. t.__next = t.__next + 1
  190.  
  191. return key, t.__source[key]
  192. end
  193.  
  194. function aura_env.orderedDoom(t, f)
  195. local keys, kn = {__source = t, __next = 1}, 1
  196.  
  197. for k in pairs(t) do
  198. keys[kn], kn = k, kn + 1
  199. end
  200.  
  201. table.sort(keys, f)
  202.  
  203. return orderednext, keys
  204. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement