Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function(event)
- if not WA_SnapshotLocale then
- setglobal("WA_SnapshotLocale", {});
- local t = WA_SnapshotLocale;
- t["Rip"] = GetSpellInfo(1079) or "Rip";
- t["Rake"] = GetSpellInfo(1822) or "Rake";
- t["Thrash"] = GetSpellInfo(106830) or "Thrash";
- t["Tiger's Fury"] = GetSpellInfo(5217) or "Tiger's Fury";
- t["Savage Roar"] = GetSpellInfo(52610) or "Savage Roar";
- t["Bloodtalons"] = GetSpellInfo(155672) or "Bloodtalons";
- t["Incarnation"] = GetSpellInfo(102543) or "Incarnation: King of the Jungle";
- t["Prowl"] = GetSpellInfo(5215) or "Prowl";
- t["Shadowmeld"] = GetSpellInfo(58984) or "Shadowmeld";
- t["Moonfire"] = GetSpellInfo(8921) or "Moonfire";
- end
- if event == "PLAYER_TALENT_UPDATE" or not WA_hasFoN then
- setglobal("WA_hasFoN", select(4, GetTalentInfo(4, 3, GetActiveSpecGroup())));
- end
- if event == "PLAYER_TALENT_UPDATE" or event == "LEARNED_SPELL_IN_TAB" or not WA_GetSnapshotState then
- local isNightElf = UnitRace("PLAYER") == "Night Elf";
- local hasBT = select(4, GetTalentInfo(7, 2, GetActiveSpecGroup()));
- local hasImpRake = true;
- if not IsSpellKnown(157276) then
- hasImpRake = false;
- end
- local l = WA_SnapshotLocale;
- setglobal("WA_GetSnapshotState", function(isRake)
- local s = {};
- if UnitBuff("player", l["Tiger's Fury"]) then
- s.TF = true;
- end
- if UnitBuff("player", l["Savage Roar"]) then
- s.SR = true;
- end
- if hasBT and UnitBuff("player", l["Bloodtalons"]) then
- s.BT = true;
- end
- if isRake and hasImpRake then
- print(GetTime()-WA_SnapshotLastStealth);
- 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
- s.ImpRake = true;
- end
- end
- return s;
- end)
- end
- if not WA_SnapshotInit then
- setglobal("WA_SnapshotInit", function(dest)
- setglobal("WA_SnapshotData", WA_SnapshotData or {
- ["Thrash"] = {
- ["cache"] = {},
- },
- });
- if dest then
- WA_SnapshotData[dest] = WA_SnapshotData[dest] or {
- ["Rip"] = {
- ["state"] = {},
- ["cache"] = {},
- },
- ["Rake"] = {
- ["state"] = {},
- ["cache"] = {},
- },
- ["Thrash"] = {
- ["state"] = {},
- },
- };
- end
- end)
- end
- if not WA_CacheSnapshot then
- setglobal("WA_CacheSnapshot", function(dest, key)
- if not key or (not dest and key ~= "Thrash") then
- return
- end
- WA_SnapshotInit(dest);
- if key == "Thrash" then
- WA_SnapshotData[key].cache = WA_GetSnapshotState();
- else
- WA_SnapshotData[dest][key].cache = WA_GetSnapshotState(key == "Rake");
- end
- end)
- end
- if not WA_SaveSnapshot then
- setglobal("WA_SaveSnapshot", function(dest, key)
- if not (dest and key) then
- return
- end
- WA_SnapshotInit(dest);
- if key == "Thrash" then
- if not WA_SnapshotData[key].cache then
- return
- end
- WA_SnapshotData[dest][key].state =
- WA_shallowCopy(WA_SnapshotData[key].cache);
- else
- if not WA_SnapshotData[dest][key].cache then
- return
- end
- WA_SnapshotData[dest][key].state = WA_shallowCopy(WA_SnapshotData[dest][key].cache);
- WA_SnapshotData[dest][key].cache = {};
- end
- if WA_SnapshotCurrentTarget and WA_SnapshotCurrentTarget == dest then
- WeakAuras.ScanEvents("WA_"..string.upper(key).."_APPLIED");
- end
- end)
- end
- if not WA_ClearSnapshot then
- setglobal("WA_ClearSnapshot", function(dest, key)
- if not (dest and key) then
- return
- end
- WA_SnapshotData[dest][key].state = {};
- if WA_SnapshotCurrentTarget and WA_SnapshotCurrentTarget == dest then
- WeakAuras.ScanEvents("WA_"..string.upper(key).."_REMOVED");
- end
- end)
- end
- if not WA_shallowCopy then
- setglobal("WA_shallowCopy", function(orig)
- local orig_type = type(orig)
- local copy
- if orig_type == 'table' then
- copy = {}
- for orig_key, orig_value in pairs(orig) do
- copy[orig_key] = orig_value
- end
- else -- number, string, boolean, etc
- copy = orig
- end
- return copy
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement