Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dsTarget, engClass;
- local function getMacroID(spellName)
- for i = 1, MAX_ACCOUNT_MACROS + MAX_CHARACTER_MACROS do
- if GetMacroSpell(i) == spellName then
- return i;
- end
- end
- end
- local function eventHandler(self, event, ...)
- if event == "COMBAT_LOG_EVENT_UNFILTERED" then
- if engClass == "DEATHKNIGHT" then
- local _, logEvent, _, _, srcName, _, _, _, destName, _, _, spellID, spellName = select(1, ...);
- if logEvent == "SPELL_AURA_APPLIED" and srcName == UnitName("player") and spellName == "Dark Simulacrum" then
- dsTarget = destName;
- elseif srcName and srcName == dsTarget and (logEvent == "SPELL_CAST_SUCCESS" or logEvent == "SPELL_MISSED" or logEvent == "SPELL_AURA_APPLIED") then
- if GetSpellPowerCost(spellID)[1].type == 0 then -- Mana cost
- SetMacroSpell(getMacroID("Dark Simulacrum"), spellName);
- dsTarget = nil;
- end
- elseif logEvent == "SPELL_AURA_REMOVED" and srcName == UnitName("player") and destName == UnitName("player") and spellName == "Dark Simulacrum" then
- SetMacroSpell(getMacroID("Dark Simulacrum"), spellName);
- dsTarget = nil;
- end
- end
- elseif event == "ADDON_LOADED" and select(1, ...) == "DarkSimulacrumMacroTooltip" then
- _, engClass = UnitClass("player");
- end
- end
- local frame = CreateFrame("Frame");
- frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
- frame:RegisterEvent("ADDON_LOADED");
- frame:SetScript("OnEvent", eventHandler);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement