Advertisement
Guest User

Soul Shard bar default

a guest
Jul 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.41 KB | None | 0 0
  1. --------------------------------------------
  2. -- SOUL SHARD BAR --
  3. -- Made by Kirin & Ipse --
  4. -- "The headless pigmy has terrible aim." --
  5. -- :PeepoHappy: --
  6. --------------------------------------------
  7.  
  8. --SHARDS DISPLAY
  9. aura_env.DisplayEmptyShards = true
  10. -- Toggle empty shards
  11. aura_env.Spacing = 4
  12. -- How much space between shards
  13. aura_env.shardX, aura_env.shardY = 0, 0
  14. -- X, Y of the text on the bar
  15. aura_env.justifyH = "CENTER"
  16. -- Justify the text horizontally
  17. -- "CENTER", "LEFT" & "RIGHT"
  18. aura_env.justifyV = "MIDDLE"
  19. -- Justify the text vertically
  20. -- "MIDDLE", "TOP" & "BOTTOM"
  21. aura_env.position = "CENTER"
  22. -- the anchor point of the text
  23. -- "TOP", "RIGHT" "BOTTOM" & "LEFT": the center-points of the respective sides.
  24. -- "TOPRIGHT", "TOPLEFT", "BOTTOMLEFT" & "BOTTOMRIGHT": corners of the rectangle.
  25. -- "CENTER": the center point of the rectangle
  26. aura_env.manualPosition = false
  27. -- Edit the position of the bars manually
  28. -- x,y values for each bar
  29. aura_env.positions = {
  30. [1] = {x = -100, y = 0},
  31. [2] = {x = -20, y = 0},
  32. [3] = {x = 60, y = 0},
  33. [4] = {x = 120, y = 0},
  34. [5] = {x = 200, y = 0},
  35. }
  36. aura_env.specificShardColours = false
  37. -- Turns on colouring for each shard
  38. -- this will overwrite all over colours
  39. aura_env.TrackDoom = true
  40. --[[
  41. If TrackDoom is enabled, Doom timers will show up on the bars,
  42. and the shard count display for Demonology will be hidden.
  43. If you have suggestions for better managing the display of
  44. both numbers, please let me know.
  45.  
  46. You can change the way Doom timers look by changing how Right
  47. Text looks like.
  48. ]]--
  49.  
  50. --SHARDS COLORS
  51. --Provide hex values
  52. local specificShardsColours = {
  53. [1] = "ff7f00ff",
  54. [2] = "ff7f00ff",
  55. [3] = "ff7f00ff",
  56. [4] = "ff7f00ff",
  57. [5] = "ff7f00ff"
  58. }
  59. local Affliction = {
  60. Foreground = "ff6800ff",
  61. Background = "ff18003b",
  62. Full = "ff6432ff",
  63. Spend = "fff0beff"
  64. }
  65. local Demonology = {
  66. Foreground = "ff6800ff",
  67. Background = "ff18003b",
  68. Full = "ff6432ff",
  69. Spend = "fff0beff",
  70. Doom = "ffe600ff"
  71. }
  72. local Destruction = {
  73. Foreground = "ffffa000",
  74. Background = "ff7c4e00",
  75. Full = "ffff3c00",
  76. Spend = "ffffff64"
  77. }
  78. local Xoroth = {--Only works when in Destruction spec
  79. Foreground = "ff64f000",
  80. Background = "ff1e4900",
  81. Full = "ff007800",
  82. Spend = "ff00d2ff"
  83. }
  84.  
  85. --SHARDS COUNT
  86. local ShardCountOnMiddle = false
  87. -- If false, will make the count appear on the latest shard.
  88. -- If true, empty shards are hidden, and you have fewer than 3 shards; the count will display on the latest shard.
  89. local DisplayModes = { --Read bellow.
  90. Affliction = false,
  91. Demonology = false,
  92. Destruction = "full"
  93. }
  94. -- "simple", displays the count as '3' and '3.5'.
  95. -- "full", displays the count as '3.0' and '3.5'.
  96. -- "tens", displays the count as '30' and '35'.
  97. -- "short", displays the amount of fragmants you have
  98. -- If false, will hide the display.
  99. local Prediction = {--What happens to the count when you are casting a spell that consumes shards.
  100. Enabled = true, --If false, everything else is ignored.
  101. Color = "ffff3200", --Use a hex code. This will also color partial Doom ticks.
  102. Text = "*" --Text that will encapsulate the count. Read bellow for more information.
  103. }
  104.  
  105. --[[ Prediction.Text -> Brackets - such as {}, [], (), <>, and <<>> - will be correctly mirrored.
  106. For \, use "\\". For ", use '"' (single - double - single), and vice-versa.
  107. An empty string - i.e., inputing "" - is acceptable.
  108. Other unlisted characters will be used as is.
  109. ]]--
  110.  
  111. --------------------------------
  112. --No touchrino from here forward
  113. --------------------------------
  114. aura_env.cost = 0
  115. aura_env.consuming = 0
  116.  
  117. local display, spec = false, GetSpecialization()
  118. local brackets = {
  119. ["{"] = "}",
  120. ["}"] = "{",
  121. ["["] = "]",
  122. ["]"] = "[",
  123. ["("] = ")",
  124. [")"] = "(",
  125. ["<"] = ">",
  126. [">"] = "<",
  127. ["<<"] = ">>",
  128. [">>"] = "<<",
  129. }
  130.  
  131. function aura_env.AdjustToSpec(specialization)
  132. local function HexToRGBPerc(hex)
  133. local string, tonumber = string, tonumber
  134. local ahex, rhex, ghex, bhex = string.sub(hex, 1, 2), string.sub(hex, 3, 4), string.sub(hex, 5, 6), string.sub(hex, 7, 8)
  135.  
  136. return {a = tonumber(ahex, 16)/255, r = tonumber(rhex, 16)/255, g = tonumber(ghex, 16)/255, b = tonumber(bhex, 16)/255}
  137. end
  138.  
  139. local p = {"Foreground", "Background", "Full", "Spend"}
  140. spec = specialization
  141.  
  142. if spec == 1 then
  143. display = DisplayModes.Affliction
  144. p.Foreground = HexToRGBPerc(Affliction.Foreground)
  145. p.Background = HexToRGBPerc(Affliction.Background)
  146. p.Full = HexToRGBPerc(Affliction.Full)
  147. p.Spend = HexToRGBPerc(Affliction.Spend)
  148. elseif spec == 2 then
  149. if aura_env.TrackDoom then
  150. display = not IsPlayerSpell(265412) and DisplayModes.Demonology
  151. else
  152. display = DisplayModes.Demonology
  153. end
  154. p.Foreground = HexToRGBPerc(Demonology.Foreground)
  155. p.Background = HexToRGBPerc(Demonology.Background)
  156. p.Full = HexToRGBPerc(Demonology.Full)
  157. p.Spend = HexToRGBPerc(Demonology.Spend)
  158. p.Doom = HexToRGBPerc(Demonology.Doom)
  159. p.Partial = HexToRGBPerc(Prediction.Color)
  160. elseif spec == 3 then
  161. display = DisplayModes.Destruction
  162. if IsPlayerSpell(101508) then
  163. p.Foreground = HexToRGBPerc(Xoroth.Foreground)
  164. p.Background = HexToRGBPerc(Xoroth.Background)
  165. p.Full = HexToRGBPerc(Xoroth.Full)
  166. p.Spend = HexToRGBPerc(Xoroth.Spend)
  167. else
  168. p.Foreground = HexToRGBPerc(Destruction.Foreground)
  169. p.Background = HexToRGBPerc(Destruction.Background)
  170. p.Full = HexToRGBPerc(Destruction.Full)
  171. p.Spend = HexToRGBPerc(Destruction.Spend)
  172. end
  173. if aura_env.specificShardColours then
  174. p.Foreground1 = HexToRGBPerc(specificShardsColours[1])
  175. p.Foreground2 = HexToRGBPerc(specificShardsColours[2])
  176. p.Foreground3 = HexToRGBPerc(specificShardsColours[3])
  177. p.Foreground4 = HexToRGBPerc(specificShardsColours[4])
  178. p.Foreground5 = HexToRGBPerc(specificShardsColours[5])
  179. end
  180. end
  181. aura_env.Pallete = p
  182. end
  183.  
  184. aura_env.AdjustToSpec(spec)
  185.  
  186. function aura_env.FormatCount(pos, shards, consumed)
  187. if display then
  188. local match = ShardCountOnMiddle and 3 or math.floor(shards - 0.1) + 1
  189.  
  190. if not aura_env.DisplayEmptyShards and ShardCountOnMiddle and shards <= 2 then
  191. match = shards
  192. end
  193.  
  194. if pos == (match or math.floor(match - 0.1) + 1) then
  195. consumed = Prediction.Enabled and consumed or 0
  196. consumed = shards > consumed and consumed or shards
  197.  
  198. if display == "simple" then
  199. shards = shards - consumed
  200. elseif display == "full" then
  201. shards = string.format("%.1f", shards - consumed)
  202. if shards == "0.0" then shards = 0 end
  203. elseif display == "tens" then
  204. shards = (shards - consumed)*10
  205. elseif display == "short" then
  206.  
  207. shards = shards%1*10
  208.  
  209. else
  210. return ""
  211. end
  212. if Prediction.Enabled and consumed > 0 then
  213. local open, close = Prediction.Text, brackets[Prediction.Text] or Prediction.Text
  214. shards = "|c"..Prediction.Color..open..shards..close.."|r"
  215. end
  216.  
  217. return shards
  218. else
  219. return ""
  220. end
  221. else
  222. return ""
  223. end
  224. end
  225.  
  226. aura_env.Doom = aura_env.Doom or {}
  227. aura_env.format = string.format
  228.  
  229. function aura_env.nextDoom(dest1, dest2)
  230. return aura_env.Doom[dest1].exp < aura_env.Doom[dest2].exp
  231. end
  232.  
  233. --I do not understand this
  234. local function orderednext(t, n)
  235. local key = t[t.__next]
  236.  
  237. if not key then return end
  238.  
  239. t.__next = t.__next + 1
  240.  
  241. return key, t.__source[key]
  242. end
  243.  
  244. function aura_env.orderedDoom(t, f)
  245. local keys, kn = {__source = t, __next = 1}, 1
  246.  
  247. for k in pairs(t) do
  248. keys[kn], kn = k, kn + 1
  249. end
  250.  
  251. table.sort(keys, f)
  252.  
  253. return orderednext, keys
  254. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement