Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.57 KB | None | 0 0
  1. -- Options and settings
  2.  
  3. -----------------
  4. -- Bar Options --
  5. -----------------
  6.  
  7. soulShard_castPrediction = { --Shows the shards that are going to be consumed at the end of the cast
  8. [1] = true, -- Affliction
  9. [2] = true, -- Demonology
  10. [3] = true, -- Destruction
  11. }
  12. soulShard_tickThreshold = 0.70 -- the amount of time doom needs to tick for to show a timer (default 70%)
  13.  
  14. soulShard_emptyShards = true -- Toggles the display of empty soul shards
  15. -- Note: This option doesn't play well with soulShard_centerCounter
  16.  
  17. ------------------
  18. -- Text Options --
  19. ------------------
  20. soulShard_textDisplay = { -- Specialization specific text options
  21. [1] = true, -- Affliction
  22. [2] = false, -- Demonology
  23. [3] = true, -- Destruction
  24. }
  25. soulShard_textPrediction = { -- Toggles shard text prediction
  26. [1] = true, -- Affliction
  27. [2] = true, -- Demonology
  28. [3] = true, -- Destruction
  29. }
  30.  
  31. soulShard_fragCounter = true -- Shows the amount of fragments you have
  32.  
  33. soulShard_fragDisplay = "decimal" -- Changes the displayed value of destro shards (options are "whole", "shortened" & "decimal")
  34. -- decimal: shows the amount of fragments you have in demical form (e.g. 3.6)
  35. -- whole: shows the raw value of Enum.PowerType.SoulShards (e.g. 36)
  36. -- shortened: shows the amount of fragments you have without shards (e.g. 6)
  37.  
  38. soulShard_textPosition = "CENTER" -- Changes the position of the text field (options are "CENTER", "LEFT", "RIGHT" & "FREE")
  39. -- Note: FREE allows the positioning of the shard counter anywhere on your user interface
  40.  
  41. soulShard_textPositionX = 0 soulShard_textPositionY = -20 -- Only used for "FREE"
  42.  
  43. soulShard_centerCounter = 0 -- Changes the position of the fragment counter
  44. -- (0 = most recent shard, 1 = shard1, 2 = shard2, etc...)
  45.  
  46. -- Text shadow options, because I like text shadow
  47. soulShard_textShadowX = 1 soulShard_textShadowY = -1
  48.  
  49. --------------------
  50. -- Colour Options --
  51. --------------------
  52. soulShard_maxShardColour = true -- Changes all shards to a specific colour when you're capped
  53.  
  54. soulShard_specColours = { -- Activates specialization specific colouring, if this option is off the colour defaults to the regular bar colour options
  55. -- changing these options requires a /reload
  56. [1] = false, -- Affliction
  57. [2] = false, -- Demonology
  58. [3] = false, -- Destruction
  59. }
  60.  
  61. -- Colours should be selected using a value between 0 and 1, using rbg you can pick the colours you want (e.g. rbgvalue/255)
  62. soulShard_colourPicker = { -- Changes the specialization specific shards
  63. -- Shard Cap
  64. ["capr"] = 0.7, -- red value
  65. ["capg"] = 0, -- green value
  66. ["capb"] = 0.35, -- blue value
  67. ["capa"] = 1, -- alpha value
  68. -- Affliction
  69. ["affr"] = 1, -- red value
  70. ["affg"] = 0, -- green value
  71. ["affb"] = 0, -- blue value
  72. ["affa"] = 1, -- alpha value
  73. ["affbr"] = 0.3, -- red background value
  74. ["affbg"] = 0, -- green background value
  75. ["affbb"] = 0, -- blue background value
  76. ["affba"] = 1, -- alpha background value
  77. -- Demonology
  78. ["demor"] = 0.5, -- red value
  79. ["demog"] = 0, -- green value
  80. ["demob"] = 1, -- blue value
  81. ["demoa"] = 1, -- alpha value
  82. ["demobr"] = 0.12, -- red background value
  83. ["demobg"] = 0, -- green background value
  84. ["demobb"] = 0.23, -- blue background value
  85. ["demoba"] = 1, -- alpha background value
  86. -- Destruction
  87. ["destr"] = 0, -- red value
  88. ["destg"] = 1, -- green value
  89. ["destb"] = 0, -- blue value
  90. ["desta"] = 1, -- alpha value
  91. ["destbr"] = 0, -- red background value
  92. ["destbg"] = 0.3, -- green background value
  93. ["destbb"] = 0, -- blue background value
  94. ["destba"] = 1, -- alpha background value
  95. }
  96. soulShard_predictionColour = { -- Changes the colour of cast prediction shards
  97. ["r"] = 0.88, -- red value
  98. ["g"] = 0, -- green value
  99. ["b"] = 0.88, -- blue value
  100. ["a"] = 1, -- alpha value
  101. }
  102. --------------------
  103. -- How Doom works --
  104. --------------------
  105.  
  106. -- Doom is a dot, it ticks for damage at the end of it's duration.
  107. -- Doom can partially tick if it's doesn't tick for it's full tickrate.
  108. -- If doom is going to fall off before reaching it's full tick duration, the tick will happen at the end of Doom's duration unless doom is refreshed. Then the current tick will take how ever much more time it needs from the refresh to fully tick
  109. -- Doom's pandemic window is based on your current haste (it's current tickrate)
  110. -- Shard generation is based on how long doom was up for before it ticked vs it's tickrate.
  111. -- Doom snapshots haste on cast, but the hasted interval is only calculated, from the next tick.
  112.  
  113. -------------
  114. -- Examples--
  115. -------------
  116.  
  117. -- Short -> Long | (High Haste -> Low Haste) --
  118.  
  119. -- Let's assume that you cast doom, with haste such that it's tickrate is 10 seconds.
  120. -- Your haste when you casted the Doom, has now snapshotted it's tickrate (10 seconds).
  121. -- If your haste effects now fall off, such that Doom's tickrate is now 20 seconds (Doom's pandemic is now 6 seconds).
  122. -- Assume that you now refresh doom at 4 seconds remaining, bringing it's duration up to 24 seconds.
  123. -- Doom will then tick 4 seconds after the refresh at 20 seconds, for a full tick.
  124. -- The next doom tick then starts, snapshotting the last refresh's haste as it's tickrate.
  125.  
  126. -- Long -> Short | (Low Haste -> High Haste) --
  127.  
  128. -- Let's say that you opened with Hand of Gul'dan (before your haste procs and Bloodlust). Applying a Doom with a tickrate of 20 seconds (snapshotting your haste).
  129. -- Now you gain some haste, through the effects of Bloodlust and whispers. Doom's tickrate is brought down to 10 seconds.
  130. -- While under the haste effects, you refresh doom at 5 seconds. Bringing the duration down to 13 seconds (10 + 10*0.3), because it's current pandemic is 3 seconds
  131. -- You've now brought the duration of a Doom, with the tickrate of 20 seconds, down to 13 seconds.
  132. -- You will get a tick at the end of dooms duration, that will deal 65% damage (13/20) and have a 65% change to generate a shard.
  133.  
  134. -------------------------
  135. -- Extended ticklength --
  136. -------------------------
  137.  
  138. -- Let's imagine a situation in which you refresh a short doom, with a long duration above it's pandemic threshold.
  139. -- For simplicity we'll keep the ticks at 10 and 20 respectively.
  140. -- You cast Doom to start the fight. Then refresh it with Hand of Gul'dan when it has 9 seconds remaining (1 seconds after you applied it).
  141. -- This brings the duration up to 26 seconds (20 + 0.3*20).
  142. -- Doom will tick at 17 seconds remaining (9 seconds after the refresh), snapshotting the next hasted interval with the last refreshed tickrate (20 seconds)
  143. -- Following the logic provided, Doom should partially tick at the end of it's duration for 85% damage, and an 85% chance to generate a shard.
  144. -- Now's assume that you refresh Doom before it expires at 3 seconds remaining, pushing doom's duration to 23 seconds (20 + 3).
  145. -- Doom now has enough time to make a full tick, so the nexttick will get pushed back from the time at which it would have expired to 6 seconds after the refresh (17 seconds remaning)
  146.  
  147. ----------
  148. -- Todo --
  149. ----------
  150. -- make a long term solution for cost reduction on spells from items and tier
  151.  
  152. ---------------------
  153. -- Shard Cost Info --
  154. ---------------------
  155. soulShard_CostInfo = { -- [spell] = {cost, dynamic cost, max cost, reduced cost item, amount reduced}
  156. -- Affliction
  157. [GetSpellInfo(30108)] = {1}, -- Unstable Affliction
  158. [GetSpellInfo(27243)] = {1}, -- Seed of Corruption
  159. -- Destruction
  160. [GetSpellInfo(116858)] = {2}, -- Chaos Bolt
  161. [GetSpellInfo(5740)] = {3}, -- Rain of Fire
  162. -- Demonology
  163. [GetSpellInfo(105174)] = {1, true, 4}, -- Hand of Gul'dan
  164. [GetSpellInfo(104316)] = {2, false, nil, aura_env.recurrentRitual, 1}, -- Call Dreadstalkers
  165. -- General
  166. [GetSpellInfo(18540)] = {1}, -- Summon Doomguard
  167. [GetSpellInfo(688)] = {1}, -- Summon Imp
  168. [GetSpellInfo(1122)] = {1}, -- Summon Infernal
  169. [GetSpellInfo(691)] = {1}, -- Summon Felhunter
  170. [GetSpellInfo(712)] = {1}, -- Summon Succubus
  171. [GetSpellInfo(697)] = {1}, -- Summon Voidwalker
  172. [GetSpellInfo(30146)] = {1} -- Summon Felguard
  173. }
  174. -- Calculate how many shards are going to be spent
  175. soulShard_getPowerFromCast = function()
  176. local cast = UnitCastingInfo("player") or UnitChannelInfo("player") or nil
  177. if not cast then
  178. return 0
  179. end
  180. local data = soulShard_CostInfo[cast] or nil
  181.  
  182. if not data then
  183. return 0
  184. end
  185. local power = data[1] or 0
  186. if data[2] then
  187. power = UnitPower("player", Enum.PowerType.SoulShards, false)
  188. if power >= data[3] then
  189. power = data[3]
  190. end
  191. end
  192. if data[4] then
  193. power = power - data[5]
  194. end
  195. return power
  196. end
  197.  
  198. -- The remaining amount after cast
  199. soulShard_shardAmount = function()
  200. if aura_env.specID == 3 then
  201.  
  202. if soulShard_fragDisplay == "shortened" then
  203. shardValue = aura_env.fragCount - aura_env.ssCount*10
  204. if shardValue == 0 and aura_env.fragCount > 0 then
  205. shardValue = 10
  206. end
  207. elseif soulShard_fragDisplay == "decimal" then
  208. shardValue = format("%.1f", aura_env.fragCount/10)
  209. elseif soulShard_fragDisplay == "whole" then
  210. shardValue = aura_env.fragCount
  211. end
  212.  
  213. elseif aura_env.specID == 1 or aura_env.specID == 2 then
  214. shardValue = aura_env.ssCount
  215. end
  216. if soulShard_textPrediction[aura_env.specID] then
  217. if aura_env.specID == 3 then
  218. if soulShard_fragDisplay == "decimal" then
  219. shardValue = format("%.1f", shardValue - soulShard_getPowerFromCast())
  220. elseif soulShard_fragDisplay == "shortened" then
  221. shardValue = shardValue
  222. elseif soulShard_fragDisplay == "whole" then
  223. shardValue = shardValue - soulShard_getPowerFromCast()*10
  224. elseif aura_env.specID == 1 or aura_env.specID == 2 then
  225. shardValue = shardValue - soulShard_getPowerFromCast()*10
  226. end
  227. else
  228. shardValue = shardValue - soulShard_getPowerFromCast()
  229. end
  230. end
  231. return shardValue
  232. end
  233.  
  234. if not soulShard_text then
  235. local region = WeakAuras.regions[aura_env.id].region
  236. soulShard_text = region:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  237. end
  238. soulShard_timerInfo = {} -- this is the table that holds everything
  239. soulShard_sortedTable = {} -- sorted table
  240.  
  241. if WeakAuras.IsOptionsOpen() then
  242.  
  243. wipe(soulShard_sortedTable)
  244.  
  245. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement