Advertisement
aneuryzm9

Combo points trigger

Apr 11th, 2022
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.62 KB | None | 0 0
  1. Custom trigger 1
  2.  
  3. function(a, e,UnitId,Type,...)
  4. local aura_env = aura_env
  5. local f = aura_env
  6.  
  7. f.CurrentSpec = select(2,GetSpecializationInfo(GetSpecialization())) or "Undefined"
  8.  
  9. if f.CurrentSpec == "Undefined" then
  10. C_Timer.After(1, function()
  11. f.CurrentSpec = select(2,GetSpecializationInfo(GetSpecialization())) or "Undefined"
  12. end)
  13. end
  14.  
  15. for k in pairs(a) do
  16. a[k].show = false
  17. a[k].changed = true
  18. end
  19.  
  20. if UnitClass("player") == "Rogue" and C_Covenants.GetActiveCovenantID() == 1 and e == "UNIT_AURA" then
  21. f.EchoVal = {}
  22. for j = 1, 40 do
  23. if tContains(f.EchoList.ID, select(10,UnitBuff("player", j))) then
  24. for m = 1, table.maxn(f.EchoList.ID) do
  25. if select(10,UnitBuff("player", j)) == f.EchoList.ID[m] then
  26. tinsert(f.EchoVal, f.EchoList.Stack[m])
  27. end
  28. end
  29. elseif select(10,UnitBuff("player", j)) == nil then
  30. break;
  31. end
  32. end
  33. end
  34.  
  35. if f.config.Debug == true and Type ~= nil and e ~= "PLAYER_ENTERING_WORLD"then
  36. print("|cff1eff00Weakauras - "..f.id..":|r Power type used: "..Type.." - Power indexed: "..f.PowerTable[f.PowerType].." - Table id: "..f.PowerType.." - Power amount: "..f.Counter)
  37. end
  38. if (UnitId == "player" and Type == f.PowerTable[f.PowerType]) or (e == "PLAYER_ENTERING_COMBAT" and UnitId == "player") or (e == "PLAYER_ENTERING_WORLD") or (e == "PLAYER_REGEN_DISABLED") then
  39.  
  40. if f.CurrentSpec ~= "Destruction" then
  41. f.Counter = UnitPower("player", f.PowerType)
  42. else
  43. local Fragments = UnitPower("player", 7, true);
  44. f.Counter = (Fragments/10);
  45. end
  46. end
  47.  
  48. if f.PowerType ~= 6 and not tContains(f.BuffSpec.Name, f.CurrentSpec..UnitClass("player")) then
  49. if f.config.WIP == true and e == "UNIT_SPELLCAST_START" and f.CurrentSpec ~= "Destruction" then
  50. for i = 1, table.maxn(f.config.Spell) do
  51. if select(1,...) ~= nil and f.config.Spell[i].ID == select(1,...) then
  52. if UnitLevel("player") >= f.config.Spell[i].Req then
  53. f.Build = f.config.Spell[i].Build
  54. break;
  55. end
  56. end
  57. end
  58.  
  59. if f.Build == 0 then
  60. local Cost = GetSpellPowerCost(select(1,...))
  61. if Cost then
  62. for _, costInfo in pairs(Cost) do
  63. if costInfo.type == f.PowerType then
  64. f.cost = costInfo.cost;
  65. break;
  66. end
  67. end
  68. end
  69. end
  70. end
  71.  
  72. if f.config.WIP == true and e == "UNIT_SPELLCAST_STOP" and f.CurrentSpec ~= "Destruction" then
  73. f.Build = 0;
  74. f.cost = 0;
  75. end
  76.  
  77. for i = 1, UnitPowerMax("player", f.PowerType) do
  78. local Val = f.Counter - (i-1)
  79. if f.cost > 0 then
  80. Val = Val - f.cost
  81. if Val < 0 then Val = 0 end;
  82. end
  83.  
  84. a[i] = {
  85. show = true,
  86. changed = true,
  87. progressType = "static",
  88. value = Val,
  89. min = 0,
  90. total = 1,
  91. autoHide = false,
  92. index = i,
  93. CP = UnitPowerMax("player", f.PowerType),
  94. Echo = tContains(f.EchoVal, i),
  95. Build = f.Build > 0 and i > UnitPower("player", f.PowerType) and i <= UnitPower("player", f.PowerType) + f.Build,
  96. Cost = f.cost > 0 and i <= UnitPower("player", f.PowerType),
  97. }
  98. end
  99.  
  100. elseif f.PowerType == 6 then --DK
  101. for i = 1,6 do
  102. local start, duration, ready = GetRuneCooldown(i)
  103. if start == nil then
  104. start = 0
  105. duration = 1
  106. ready = 1
  107. end
  108. a[i] = {
  109. show = true,
  110. changed = true,
  111. progressType = "timed",
  112. expirationTime = start + duration,
  113. duration = duration,
  114. index = i,
  115. Full = ready,
  116. CP = 6,
  117. Type = f.PowerType,
  118. }
  119. end
  120.  
  121. table.sort(a, function(b,c)
  122. if b.expirationTime and c.expirationTime then
  123. return b.expirationTime < c.expirationTime
  124. else
  125. return true
  126. end
  127. end)
  128.  
  129. elseif tContains(f.BuffSpec.Name, f.CurrentSpec..UnitClass("player")) then --Buff reliant specs
  130. local ind = 0
  131. for i = 1, table.maxn(f.BuffSpec.Name) do
  132. if f.BuffSpec.Name[i] == f.CurrentSpec..UnitClass("player") then
  133. ind = i
  134. break;
  135. end
  136. end
  137.  
  138. for j = 1, f.BuffSpec.Cap[ind] do
  139. local BuffVal = 0;
  140. for m = 1, 40 do
  141. if UnitBuff("player", m) == nil then
  142. break;
  143. elseif select(10, UnitBuff("player", m)) == f.BuffSpec.ID[ind] then
  144. BuffVal = select(3, UnitBuff("player", m))
  145. break;
  146. end
  147. end
  148.  
  149. a[j] = {
  150. show = true,
  151. changed = true,
  152. progressType = "static",
  153. value = BuffVal - (j - 1),
  154. min = 0,
  155. total = 1,
  156. autoHide = false,
  157. index = j,
  158. CP = f.BuffSpec.Cap[ind]
  159. }
  160.  
  161. end
  162. end
  163.  
  164. return true
  165. end
  166.  
  167.  
  168. Custom variable for trigger 1
  169.  
  170. {
  171. CP = "number",
  172. Echo = "bool",
  173. Full = "bool",
  174. Type = "number",
  175. Build = "bool",
  176. Cost = "bool",
  177. }
  178.  
  179.  
  180. Custom trigger 2
  181.  
  182. function(e,...)
  183. if aura_env.config.Debug == true then
  184. print("DEBUG - "..aura_env.id.." - trigger 2 - Event - "..e)
  185. end
  186. local CurrentSpec = select(2,GetSpecializationInfo(GetSpecialization()))
  187. if CurrentSpec ~= nil and tContains(aura_env.EnabledSpecs, CurrentSpec..UnitClass("player")) then
  188. if UnitClass("player") == "Druid" and CurrentSpec ~= "Feral" then
  189. return WA_GetUnitBuff("player", 768)
  190. else
  191. return true
  192. end
  193. else
  194. return false
  195. end
  196. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement