Jump to content

Druid Guardian Code Question


Recommended Posts

How do I Make this code that is made to not Interupt if the spell is shielded, into a code to use if the spell isnt interuptable but can stop the spell by stunning them or at least trying to stuff them.


local spellid=106839
local spellname=GetSpellInfo(spellid)
if UnitExists("target") and not UnitIsFriend("player", "target") and (IsSpellInRange(spellname, "target")==1) then
    local spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitCastingInfo("target");
    local isChanneling=false
    if (spell==nil) then
        spell, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitChannelInfo("target");
        isChanneling=true
    end
    if (spell~=nil) then
        if (nonInterrupt==false) then
            local guid=UnitGUID("target");
            local type, zero, serverId, instanceId, zoneId, npcId, spawnUid = strsplit("-",guid);
            local dontKick={[82618]={171807};    --[[ Tor'goroth, skip Shadow Bolt to kick Consume Life ]]
                            [82682]={166465};    --[[ Archmage Sol, skip Frost Bolt to kick Parasitic Growth ]]
                                
    --[[ [86135]={172014,172024,172005};  test Ralshira  ]]

                        };
            result=true;
            npcId=tonumber(npcId);
            if (dontKick[npcId]~=nil) then
                if (dontKick[npcId][1]~=nil) then
                    for i=1, #dontKick[npcId] do
                        if (spell==GetSpellInfo(dontKick[npcId])) then
                            result=false
                        end
                    end
                end
            end
        end
        if result==false then     --[[ spell not interruptable, we have to save us !!!]]
            local t=GetTime();
            endTime=endTime/1000 - t;
            if (endTime < 3) or isChanneling then --[[ dont start to early ]]
                local buffexp,buff,buffcnt={},{},{};
                local i,n,c,x,id,found=0;
                repeat
                    i=i+1;
                    n,_,_,c,_,_,x,_,_,_,id=UnitAura("target",i,"PLAYER HARMFUL");
                    if n then
                        buffcnt[n]=c
                        buffexp[n]=x-t
                        buff[n]=id;
                        found=true
                    end
                until (not n) or (i==40);
                local CatForm=GetSpellInfo(768)
                local BearForm=GetSpellInfo(5487)
                local SurvInstincts=GetSpellInfo(61336)
                local Barkskin=GetSpellInfo(22812)
                local Ironfur=GetSpellinfo(192081)
                local MarkOfUrsol=GetSpellInfo(192083)
                local spellname=Ironfur
                local start, duration, enabled = GetSpellCooldown(SurvInstincts)
                if found then
                    if buff[BearForm] then
                        if not buff[SurvInstincts] then
                            if (duration==0) then
                                spellname=SurvInstincts
                            elseif not buff[Barkskin] then
                                start, duration, enabled = GetSpellCooldown(Barkskin)
                                if (duration==0) then
                                    spellname=Barkskin
                                end
                            end
                        end
                    else
                        spellname=BearForm
                    end
                else
                    spellname=BearForm
                end
                if (spellname==Ironfur) then
                    start, duration, enabled = GetSpellCooldown(Barkskin)
                    if (duration~=0) then
                        spellname=false
                    end
                end
                if spellname then
                    CastSpellByName(spellname,"player")
                end
            end
            
        end
    end
end


Anyone Know what Im trying to do here?

Link to comment
Share on other sites

Just add a Lua condition 
 

spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitCastingInfo("target")

Use nonInterrupt as return var and look for value 1 (interruptable).

Link to comment
Share on other sites

Hey thanks!!! No I need to learn to change this code so I can Put in all my other tank spec. I role all the tanks specs. So I might be asking you some more questions soon lol

 

Link to comment
Share on other sites

On 6/5/2017 at 11:22 AM, Schaka said:

Just add a Lua condition 
 


spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitCastingInfo("target")

Use nonInterrupt as return var and look for value 1 (interruptable).

Ok where would I add this into my LUA Code to make it work?

Link to comment
Share on other sites

Duh...... I was tired when I asked that..... LOL Thanks. :) But do I add in like this???

 


local spellid=106839
local spellname=GetSpellInfo(spellid)
if UnitExists("target") and not UnitIsFriend("player", "target") and (IsSpellInRange(spellname, "target")==1) then
    local spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitCastingInfo("target");
    local isChanneling=false
    if (spell==nil) then
        spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, nonInterrupt = UnitCastingInfo("target");
        isChanneling=true
    end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...