Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.11 KB | None | 0 0
  1. function(event)
  2. if not WA_SnapshotLocale then
  3. setglobal("WA_SnapshotLocale", {});
  4.  
  5. local t = WA_SnapshotLocale;
  6.  
  7. t["Rip"] = GetSpellInfo(1079) or "Rip";
  8. t["Rake"] = GetSpellInfo(1822) or "Rake";
  9. t["Thrash"] = GetSpellInfo(106830) or "Thrash";
  10. t["Tiger's Fury"] = GetSpellInfo(5217) or "Tiger's Fury";
  11. t["Savage Roar"] = GetSpellInfo(52610) or "Savage Roar";
  12. t["Bloodtalons"] = GetSpellInfo(155672) or "Bloodtalons";
  13. t["Incarnation"] = GetSpellInfo(102543) or "Incarnation: King of the Jungle";
  14. t["Prowl"] = GetSpellInfo(5215) or "Prowl";
  15. t["Shadowmeld"] = GetSpellInfo(58984) or "Shadowmeld";
  16. t["Moonfire"] = GetSpellInfo(8921) or "Moonfire";
  17. end
  18.  
  19. if event == "PLAYER_TALENT_UPDATE" or not WA_hasFoN then
  20. setglobal("WA_hasFoN", select(4, GetTalentInfo(4, 3, GetActiveSpecGroup())));
  21. end
  22.  
  23. if event == "PLAYER_TALENT_UPDATE" or event == "LEARNED_SPELL_IN_TAB" or not WA_GetSnapshotState then
  24.  
  25. local isNightElf = UnitRace("PLAYER") == "Night Elf";
  26. local hasBT = select(4, GetTalentInfo(7, 2, GetActiveSpecGroup()));
  27. local hasImpRake = true;
  28. if not IsSpellKnown(157276) then
  29. hasImpRake = false;
  30. end
  31.  
  32. local l = WA_SnapshotLocale;
  33.  
  34. setglobal("WA_GetSnapshotState", function(isRake)
  35. local s = {};
  36. if UnitBuff("player", l["Tiger's Fury"]) then
  37. s.TF = true;
  38. end
  39.  
  40. if UnitBuff("player", l["Savage Roar"]) then
  41. s.SR = true;
  42. end
  43.  
  44. if hasBT and UnitBuff("player", l["Bloodtalons"]) then
  45. s.BT = true;
  46. end
  47.  
  48. if isRake and hasImpRake then
  49. print(GetTime()-WA_SnapshotLastStealth);
  50.  
  51. if UnitBuff("player", l["Incarnation"]) or UnitBuff("player", l["Prowl"]) or (isNightElf and UnitBuff("player", l["Shadowmeld"])) or (WA_SnapshotLastStealth and GetTime()-WA_SnapshotLastStealth <= 0.1) then
  52. s.ImpRake = true;
  53. end
  54. end
  55.  
  56. return s;
  57. end)
  58. end
  59.  
  60. if not WA_SnapshotInit then
  61. setglobal("WA_SnapshotInit", function(dest)
  62. setglobal("WA_SnapshotData", WA_SnapshotData or {
  63. ["Thrash"] = {
  64. ["cache"] = {},
  65. },
  66. });
  67.  
  68. if dest then
  69. WA_SnapshotData[dest] = WA_SnapshotData[dest] or {
  70. ["Rip"] = {
  71. ["state"] = {},
  72. ["cache"] = {},
  73. },
  74. ["Rake"] = {
  75. ["state"] = {},
  76. ["cache"] = {},
  77. },
  78. ["Thrash"] = {
  79. ["state"] = {},
  80. },
  81. };
  82. end
  83. end)
  84. end
  85.  
  86. if not WA_CacheSnapshot then
  87. setglobal("WA_CacheSnapshot", function(dest, key)
  88. if not key or (not dest and key ~= "Thrash") then
  89. return
  90. end
  91.  
  92. WA_SnapshotInit(dest);
  93.  
  94. if key == "Thrash" then
  95. WA_SnapshotData[key].cache = WA_GetSnapshotState();
  96. else
  97. WA_SnapshotData[dest][key].cache = WA_GetSnapshotState(key == "Rake");
  98. end
  99. end)
  100. end
  101.  
  102. if not WA_SaveSnapshot then
  103. setglobal("WA_SaveSnapshot", function(dest, key)
  104. if not (dest and key) then
  105. return
  106. end
  107.  
  108. WA_SnapshotInit(dest);
  109.  
  110. if key == "Thrash" then
  111. if not WA_SnapshotData[key].cache then
  112. return
  113. end
  114.  
  115. WA_SnapshotData[dest][key].state =
  116. WA_shallowCopy(WA_SnapshotData[key].cache);
  117. else
  118. if not WA_SnapshotData[dest][key].cache then
  119. return
  120. end
  121.  
  122. WA_SnapshotData[dest][key].state = WA_shallowCopy(WA_SnapshotData[dest][key].cache);
  123. WA_SnapshotData[dest][key].cache = {};
  124. end
  125.  
  126. if WA_SnapshotCurrentTarget and WA_SnapshotCurrentTarget == dest then
  127. WeakAuras.ScanEvents("WA_"..string.upper(key).."_APPLIED");
  128. end
  129. end)
  130. end
  131.  
  132. if not WA_ClearSnapshot then
  133. setglobal("WA_ClearSnapshot", function(dest, key)
  134. if not (dest and key) then
  135. return
  136. end
  137.  
  138. WA_SnapshotData[dest][key].state = {};
  139.  
  140. if WA_SnapshotCurrentTarget and WA_SnapshotCurrentTarget == dest then
  141. WeakAuras.ScanEvents("WA_"..string.upper(key).."_REMOVED");
  142. end
  143. end)
  144. end
  145.  
  146. if not WA_shallowCopy then
  147. setglobal("WA_shallowCopy", function(orig)
  148. local orig_type = type(orig)
  149. local copy
  150. if orig_type == 'table' then
  151. copy = {}
  152. for orig_key, orig_value in pairs(orig) do
  153. copy[orig_key] = orig_value
  154. end
  155. else -- number, string, boolean, etc
  156. copy = orig
  157. end
  158. return copy
  159. end)
  160. end
  161. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement