arthasdk icon

AutoLevelUP Queue 1.2a

arthasdk | PRO | 01/02/13 11:54:52 AM UTC | 0 ⭐ | 132 👁️ | Never ⏰ | []
Lua |

11.69 KB

|

None

|

0 👍

/

0 👎

--^^^^^^^^^^^^^^^^ArthasDK's AutoLevelUP Queue v1.2a^^^^^^^^^^^^^^^^
--   Put Abilities in the Queue Using the Shift Menu and enjoy
--          May bug but should not i tested it a lot.
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if myHero.charName == "Udyr" or myHero.charName == "Khazix" then PrintChat("Sorry, Auto Levelup Queue does not work with that champion!") return end
require "AllClass"
 
local queue={}
local spellcounts={5,5,5,3}
local beforeLevelUp={0,0,0,0}
local afterLevelUp={0,0,0,0}
local levelUpRequired= false
local popFromQueue= false
local needToDelete =-1
local resetKey=string.byte('L')
 
 
function OnLoad()
    spellcounts[1]=5-player:GetSpellData(SPELL_1).level
    spellcounts[2]=5-player:GetSpellData(SPELL_2).level
    spellcounts[3]=5-player:GetSpellData(SPELL_3).level
    spellcounts[4]=3-player:GetSpellData(SPELL_4).level
    PrintChat(">> Loaded AutoSkillLevelUp Queue by ArthasDK")
    replaceTable(beforeLevelUp,1,player:GetSpellData(SPELL_1).level )
    replaceTable(beforeLevelUp,2,player:GetSpellData(SPELL_2).level )   
    replaceTable(beforeLevelUp,3,player:GetSpellData(SPELL_3).level )   
    replaceTable(beforeLevelUp,4,player:GetSpellData(SPELL_4).level )
    ArthasDKMenu = scriptConfig("Auto Level Queue", "ArthasDK AutoLevelQueue")
    ArthasDKMenu:addParam("showQueue", "Show Queue", SCRIPT_PARAM_ONOFF, true)
    ArthasDKMenu:addParam("add444", "Always level R when possible", SCRIPT_PARAM_ONOFF, false)
    ArthasDKMenu:addParam("addQ", "Add 'Q' to Queue", SCRIPT_PARAM_ONOFF, false)
    ArthasDKMenu:addParam("addW", "Add 'W' to Queue", SCRIPT_PARAM_ONOFF, false)
    ArthasDKMenu:addParam("addE", "Add 'E' to Queue", SCRIPT_PARAM_ONOFF, false)
    if ArthasDKMenu.add444== false then ArthasDKMenu:addParam("addR", "Add 'R' to Queue", SCRIPT_PARAM_ONOFF, false) end
    ArthasDKMenu:addParam("addQPriority", "Add 'Q's in Priority", SCRIPT_PARAM_ONOFF, false)
    ArthasDKMenu:addParam("addWPriority", "Add 'W's in Priority", SCRIPT_PARAM_ONOFF, false)
    ArthasDKMenu:addParam("addEPriority", "Add 'E's in Priority", SCRIPT_PARAM_ONOFF, false)
    if ArthasDKMenu.add444== false then ArthasDKMenu:addParam("addRPriority", "Add 'R's in Priority", SCRIPT_PARAM_ONOFF, false) end
    ArthasDKMenu:addParam("resetQueue", "Reset The Queue", SCRIPT_PARAM_ONKEYDOWN, false, resetKey)
    ArthasDKMenu.addQPriority = false
    ArthasDKMenu.addWPriority = false
    ArthasDKMenu.addEPriority = false
    ArthasDKMenu.addRPriority = false
    ArthasDKMenu.addQ = false
    ArthasDKMenu.addW = false
    ArthasDKMenu.addE = false
    ArthasDKMenu.addR = false
    ArthasDKMenu.resetQueue= false
    if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
    end
end
 
function OnWndMsg(msg,key)      
    SC__OnWndMsg(msg,key)
end 
 
function replaceTable(Table,i,value)
    if i <= #Table then
        table.remove(Table,i)
        table.insert(Table,i,value)
    end
end
 
function rightShift(Table,pos)
    for i=pos,#Table-1,1 do
        Table[i]=Table[i+1]
    end
    Table[#Table]=0
end
 
function FindFirstOccurenceOf(Table,item)
    for i=1,#Table,1 do
        if Table[i]==item then return i end
    end
    return -1
end
 
 
 
function OnSendChat(text)
        if text == ".4" or text==".R" or text ==".r" then
                BlockChat()
                if tonumber(spellcounts[4])> 0 then
                    table.insert(queue,4)
                    PrintChat("Pushed R!")
                    spellcounts[4]= tonumber(spellcounts[4])-1
                end
        elseif text == ".3" or text==".E" or text ==".e" then
                BlockChat()
                if tonumber(spellcounts[3])> 0 then
                     table.insert(queue,3)
                     PrintChat("Pushed E!")
                    spellcounts[3]= tonumber(spellcounts[3])-1
                end
        elseif text == ".2" or text==".W" or text ==".w" then
                BlockChat()
                if tonumber(spellcounts[2])> 0 then
                     table.insert(queue,2)
                     PrintChat("Pushed W!")
                    spellcounts[2]= tonumber(spellcounts[2])-1
                end
        elseif text == ".1" or text==".q" or text ==".Q" then
                BlockChat()
                if tonumber(spellcounts[1])> 0 then
                     table.insert(queue,1)
                     PrintChat("Pushed Q!")
                    spellcounts[1]= tonumber(spellcounts[1])-1
                end
        elseif text == "!1" or text=="!q" or text =="!Q" then
                BlockChat()
                local count= tonumber(spellcounts[1])
                for i =1,count,1 do 
                    table.insert(queue,1)  
                    spellcounts[1]= tonumber(spellcounts[1])-1
                end           
                PrintChat("Pushed Qx"..tostring(count).."!")
        elseif text == "!2" or text=="!w" or text =="!W" then
                BlockChat()
                local count= tonumber(spellcounts[2])
                for i =1,count,1 do 
                    table.insert(queue,2)  
                    spellcounts[2]= tonumber(spellcounts[2])-1
                end            
                PrintChat("Pushed Wx"..tostring(count).."!")
        elseif text == "!3" or text=="!E" or text =="!E" then
                BlockChat()
                local count= tonumber(spellcounts[3])
                for i =1,count,1 do 
                    table.insert(queue,3)  
                    spellcounts[3]= tonumber(spellcounts[3])-1
                end           
                PrintChat("Pushed Ex"..tostring(count).."!")
        elseif text == "!4" or text=="!r" or text =="!R" then
                BlockChat()
                local count= tonumber(spellcounts[4])
                for i =1,count,1 do 
                    table.insert(queue,4)  
                    spellcounts[4]= tonumber(spellcounts[4])-1
                end              
                PrintChat("Pushed Rx"..tostring(count).."!")
        end
end
 
function OnTick()
    if ArthasDKMenu.resetQueue== true then
        for i=1,#queue,1 do
            table.remove (queue)
        end
        spellcounts[1]=5-player:GetSpellData(SPELL_1).level
        spellcounts[2]=5-player:GetSpellData(SPELL_2).level
        spellcounts[3]=5-player:GetSpellData(SPELL_3).level
        spellcounts[4]=3-player:GetSpellData(SPELL_4).level
        PrintChat("Cleared the Queue")  
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end 
        ArthasDKMenu.resetQueue= false
        
    end
    
    if ArthasDKMenu.addQ ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        if tonumber(spellcounts[1])> 0 then
            table.insert(queue,1)
            PrintChat("Pushed Q!")
            spellcounts[1]= tonumber(spellcounts[1])-1
        end
        ArthasDKMenu.addQ = false
    end
    
    if ArthasDKMenu.addW ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        if tonumber(spellcounts[2])> 0 then
            table.insert(queue,2)
            PrintChat("Pushed W!")
            spellcounts[2]= tonumber(spellcounts[2])-1
        end
        ArthasDKMenu.addW = false
    end
    
    if ArthasDKMenu.addE ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        if tonumber(spellcounts[3])> 0 then
            table.insert(queue,3)
            PrintChat("Pushed E!")
            spellcounts[3]= tonumber(spellcounts[3])-1
        end
        ArthasDKMenu.addE = false
    end
    
    if ArthasDKMenu.addR ==true and ArthasDKMenu.add444== false then
        if tonumber(spellcounts[4])> 0 then
            table.insert(queue,4)
            PrintChat("Pushed R!")
            spellcounts[4]= tonumber(spellcounts[4])-1
        end
        ArthasDKMenu.addR = false
    end
    
    if ArthasDKMenu.addQPriority ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        local count= tonumber(spellcounts[1])
        for i =1,count,1 do 
            table.insert(queue,1)  
            spellcounts[1]= tonumber(spellcounts[1])-1
        end           
        PrintChat("Pushed Qx"..tostring(count).."!")
        ArthasDKMenu.addQPriority = false
    end
    
    if ArthasDKMenu.addWPriority ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        local count= tonumber(spellcounts[2])
        for i =1,count,1 do 
            table.insert(queue,2)  
            spellcounts[2]= tonumber(spellcounts[2])-1
        end           
        PrintChat("Pushed Wx"..tostring(count).."!")
        ArthasDKMenu.addWPriority = false
    end
    
    if ArthasDKMenu.addEPriority ==true then
        if ArthasDKMenu.add444== true then
            local count= tonumber(spellcounts[4])
            for i =1,count,1 do 
                table.insert(queue,4)  
                spellcounts[4]= tonumber(spellcounts[4])-1
            end     
        end
        local count= tonumber(spellcounts[3])
        for i =1,count,1 do 
            table.insert(queue,3)  
            spellcounts[3]= tonumber(spellcounts[3])-1
        end           
        PrintChat("Pushed Ex"..tostring(count).."!")
        ArthasDKMenu.addEPriority = false
    end
    
    if ArthasDKMenu.addRPriority ==true and ArthasDKMenu.add444== false then
        local count= tonumber(spellcounts[4])
        for i =1,count,1 do 
            table.insert(queue,4)  
            spellcounts[4]= tonumber(spellcounts[4])-1
        end           
        PrintChat("Pushed Rx"..tostring(count).."!")
        ArthasDKMenu.addRPriority = false
    end
 
 
    if player:GetSpellData(SPELL_1).level + player:GetSpellData(SPELL_2).level + player:GetSpellData(SPELL_3).level + player:GetSpellData(SPELL_4).level < player.level and #queue>0 then 
        levelUpRequired = true
    end
    
    if levelUpRequired== true then
        for i=1,#queue,1 do
            LevelSpell(tonumber(queue[i])-1)
        end
        popFromQueue= true
        levelUpRequired=false
    end
    
    if popFromQueue== true then
        replaceTable(afterLevelUp,1,player:GetSpellData(SPELL_1).level )
        replaceTable(afterLevelUp,2,player:GetSpellData(SPELL_2).level )    
        replaceTable(afterLevelUp,3,player:GetSpellData(SPELL_3).level )    
        replaceTable(afterLevelUp,4,player:GetSpellData(SPELL_4).level )
        for i=1,4,1 do
            if beforeLevelUp[i]~=afterLevelUp[i] then
                needToDelete=i
            end
        end
    end
    
    if needToDelete>0 then
        PrintChat("Leveled UP : Ability"..tostring(tonumber(needToDelete)))
        local index=FindFirstOccurenceOf(queue,needToDelete)
        rightShift(queue,index)
        replaceTable(beforeLevelUp,1,player:GetSpellData(SPELL_1).level )
        replaceTable(beforeLevelUp,2,player:GetSpellData(SPELL_2).level )   
        replaceTable(beforeLevelUp,3,player:GetSpellData(SPELL_3).level )   
        replaceTable(beforeLevelUp,4,player:GetSpellData(SPELL_4).level )
        popFromQueue=false
        needToDelete=-1
    end
    
end
 
 
 
function PrintTable(Table)
    local String=""
    for i=1,#Table do 
        if Table[i] ~= 0 then 
            if ArthasDKMenu.add444== false then 
                String=String..tostring(Table[i]).." " 
            end
            if Table[i] ~= 4 and ArthasDKMenu.add444== true then
                String=String..tostring(Table[i]).." " 
            end
        end
    end
    return String
end
 
function noOfNonZeroElements(Table)
    local result=0
    if #Table == 0 then return 0 end
    for i=1,#Table do 
        if Table[i] ~= 0 then result=result+1 end
    end
    return result
end
 
 
function OnDraw()
    if ArthasDKMenu.showQueue == true and noOfNonZeroElements(queue) < 1 then DrawText("Please insert atleast one element in the Queue.", 25, 0, 25, 0xFF00ff00) end
    if ArthasDKMenu.showQueue == true and noOfNonZeroElements(queue)>0 and player.level < 18 then DrawText("Printing the Contents of queue :"..PrintTable(queue), 25, 0, 0, 0xFF00ff00) end
    if ArthasDKMenu.showQueue == true and player.level == 18 then DrawText("All Done :)!! ty for using", 25, 0, 0, 0xFF00ff00) end
    SC__OnDraw()
end

Comments