local Spells1 = {"Scatter Shot", "Blind", "Gouge"}
local Spells2 = {"Silence", "Counterspell", "Silencing Shot", "Strangulate", "Garrote", "Solar Beam", "Spell Lock"}
local Spells3 = {"Intimidating Shout"}
local Spells4 = {"Kick", "Rebuke", "Wind Shear", "Pummel", "Mind Freeze", "Skull Bash"}
local Delay = 0.002; -- The Delay the Script waits for casting in seconds.
local SetStopCasting = true;
function IsCastingOrChanneling()
if UnitCastingInfo("player") or UnitChannelInfo("player") and SetStopCasting == true then return 1; end
end
if reset == nil then
local reset = 0
timer = 0
end
local type, hideCaster, srcGUID, sourceName, srcFlags, srcFlags2, dstGUID, dstName, Name, spellSchool, missType;
if GetTime() >= timer and reset == false then
if GetSpellCooldown(ACCSpell) == 0 then
if IsCastingOrChanneling() == 1 then SpellStopCasting(); end
print("|cFFFF6060" .. srcName .. "|r" .. " hits you with " .. "|cFFFFFF00" .. spellName .. "|r" .. ". Trying to cast " .. ACCSpell .. "...");
else
print("|cFFFF6060" .. srcName .. "|r" .. " hits you with " .. "|cFFFFFF00" .. spellName .. "|r" .. ". Unfortunately " .. ACCSpell .. " is on Cooldown. :(");
end
CastSpellByName(ACCSpell);
timer = nil;
reset = nil;
end
local frame = CreateFrame("FRAME", "AntiCC");
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") ;
local function eventHandler(self, event, ...)
type, hideCaster, srcGUID, srcName, srcFlags, srcFlags2, dstGUID, dstName = select(2, ...); -- Read Combat Log
if type == "SPELL_CAST_SUCCESS" then
spellName = select(13, ...)
if dstName == UnitName("player") and tContains(Spells1, spellName) then
timer = GetTime() + Delay;
reset = false;
ACCSpell = "Shadow Word: Death";
elseif dstName == UnitName("player") and tContains(Spells2, spellName) then
timer = GetTime() + Delay;
reset = false;
ACCSpell = "Inner Focus";
elseif dstName == UnitName("player") and tContains(Spells3, spellName) then
timer = GetTime() + Delay;
reset = false;
ACCSpell = "Fear Ward";
elseif dstName == UnitName("player") and tContains(Spells4, spellName) then
timer = GetTime() + Delay;
reset = false;
ACCSpell = "Auto Attack";
end
elseif type == "SPELL_MISSED" then
spellName, spellSchool, missType = select(13, ...)
if dstName == UnitName("player") and (tContains(Spells1, spellName) or tContains(Spells2, spellName) or tContains(Spells3, spellName) ) and not missType == "ABSORB" then
Reset = true;
ACCprint("|cFFFF6060" .. srcName .. "|r" .. " casted " .. "|cFFFFFF00" .. spellName .. "|r" .. " on you, but it failed (" .. missType .. ").");
end
end
end
frame:SetScript("OnEvent", eventHandler);
habe den code ein wenig verändert für 4.3.4 und es läuft auf pqr jedoch kommen die casts zu spät...:confused: