SHJordan

Master Yi.lua

Feb 12th, 2013
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.03 KB | None | 0 0
  1.     if myHero.charName ~= "MasterYi" then return end
  2.  
  3.  
  4.  
  5.     --[[            Code            ]]
  6.  
  7.     local range = 600
  8.  
  9.     local tick = nil
  10.  
  11.     -- draw
  12.  
  13.     local waittxt = {}
  14.  
  15.     local calculationenemy = 1
  16.  
  17.     local floattext = {"Skills are not available","Able to fight","Killable","Murder him!"}
  18.  
  19.     local killable = {}
  20.  
  21.     -- ts
  22.  
  23.     local ts
  24.  
  25.     --
  26.  
  27.     local ignite = nil
  28.  
  29.     local WeHaveMana = false
  30.  
  31.     local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
  32.  
  33.     local QREADY, EREADY, RREADY, DFGREADY, HXGREADY, BWCREADY, IREADY = false, false, false, false, false, false, false
  34.  
  35.      
  36.  
  37.     function OnLoad()
  38.  
  39.             PrintChat(">> MasterYi Combo 1.2 loaded!")
  40.  
  41.             MYiConfig = scriptConfig("Master Yi Combo 1.2", "yicombo")
  42.  
  43.             MYiConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  44.  
  45.             MYiConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  46.  
  47.             MYiConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  48.  
  49.             MYiConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  50.  
  51.             MYiConfig:addParam("autoQ", "Auto Q on killable enemy", SCRIPT_PARAM_ONOFF, true)
  52.  
  53.             --MYiConfig:permaShow("scriptActive")
  54.  
  55.             ts = TargetSelector(TARGET_LOW_HP,range+50,DAMAGE_MAGIC,false)
  56.  
  57.             ts.name = "MasterYi"
  58.  
  59.             MYiConfig:addTS(ts)
  60.  
  61.             if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  62.  
  63.             elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  64.  
  65.             for i=1, heroManager.iCount do waittxt[i] = i*3 end
  66.  
  67.     end
  68.  
  69.      
  70.  
  71.     function OnTick()
  72.  
  73.             ts:update()
  74.  
  75.             DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  76.  
  77.             QREADY = (myHero:CanUseSpell(_Q) == READY)
  78.  
  79.             EREADY = (myHero:CanUseSpell(_E) == READY)
  80.  
  81.             RREADY = (myHero:CanUseSpell(_R) == READY)
  82.  
  83.             DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  84.  
  85.             HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  86.  
  87.             BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  88.  
  89.             IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  90.  
  91.             if tick == nil or GetTickCount()-tick >= 100 then
  92.  
  93.                     tick = GetTickCount()
  94.  
  95.                     DmgCalculation()
  96.  
  97.             end
  98.  
  99.             if MYiConfig.autoQ and ts.target then
  100.  
  101.                     --mana check managament:
  102.  
  103.                     local SpellDataQ2 = myHero:GetSpellData(_Q)
  104.  
  105.                     local totalCost2 = 100 + (60+10*SpellDataQ2.level) --total cost of mana necessary to do a R+Q
  106.  
  107.                     if myHero.mana >= totalCost2 then
  108.  
  109.                             WeHaveMana2 = true
  110.  
  111.                     else
  112.  
  113.                             WeHaveMana2 = false
  114.  
  115.                     end
  116.  
  117.                     --end mana check
  118.  
  119.                     local qdmg = getDmg("Q",ts.target,myHero)
  120.  
  121.                     if WeHaveMana2 and QREADY and ts.target.health < qdmg then
  122.  
  123.                             if RREADY then CastSpell(_R) end
  124.  
  125.                             if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  126.  
  127.                     end
  128.  
  129.                     if not WeHaveMana2 and QREADY and ts.target.health < qdmg then
  130.  
  131.                             if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  132.  
  133.                     end            
  134.  
  135.             end
  136.  
  137.             if MYiConfig.scriptActive and ts.target then
  138.  
  139.             --mana check managament:
  140.  
  141.                     local SpellDataQ = myHero:GetSpellData(_Q)
  142.  
  143.                     local totalCost = 100 + (60+10*SpellDataQ.level) --total cost of mana necessary to do a R+Q
  144.  
  145.                     if myHero.mana >= totalCost then
  146.  
  147.                             WeHaveMana = true
  148.  
  149.                     else
  150.  
  151.                             WeHaveMana = false
  152.  
  153.                     end
  154.  
  155.             --end mana check
  156.  
  157.                     if DFGREADY then CastSpell(DFGSlot, ts.target) end
  158.  
  159.                     if HXGREADY then CastSpell(HXGSlot, ts.target) end
  160.  
  161.                     if BWCREADY then CastSpell(BWCSlot, ts.target) end
  162.  
  163.                     if WeHaveMana then
  164.  
  165.                             if RREADY then CastSpell(_R) end
  166.  
  167.                             if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  168.  
  169.                     else
  170.  
  171.                             if QREADY and GetDistance(ts.target) <= range then CastSpell(_Q, ts.target) end
  172.  
  173.                     end
  174.  
  175.                     if EREADY then CastSpell(_E) end
  176.  
  177.                     myHero:Attack(ts.target)
  178.  
  179.             end
  180.  
  181.             if MYiConfig.autoignite then  
  182.  
  183.                     if IREADY then
  184.  
  185.                             local ignitedmg = 0    
  186.  
  187.                             for j = 1, heroManager.iCount, 1 do
  188.  
  189.                                     local enemyhero = heroManager:getHero(j)
  190.  
  191.                                     if ValidTarget(enemyhero,600) then
  192.  
  193.                                             ignitedmg = 50 + 20 * myHero.level
  194.  
  195.                                             if enemyhero.health <= ignitedmg then
  196.  
  197.                                                     CastSpell(ignite, enemyhero)
  198.  
  199.                                             end
  200.  
  201.                                     end
  202.  
  203.                             end
  204.  
  205.                     end
  206.  
  207.             end
  208.  
  209.     end
  210.  
  211.     function DmgCalculation()
  212.  
  213.             local enemy = heroManager:GetHero(calculationenemy)
  214.  
  215.             if ValidTarget(enemy) then
  216.  
  217.                     local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  218.  
  219.                     local qdamage = getDmg("Q",enemy,myHero)
  220.  
  221.                     local hitdamage = getDmg("AD",enemy,myHero)
  222.  
  223.                     local dfgdamage = (DFGSlot and getDmg("DFG",enemy,myHero) or 0)
  224.  
  225.                     local hxgdamage = (HXGSlot and getDmg("HXG",enemy,myHero) or 0)
  226.  
  227.                     local bwcdamage = (BWCSlot and getDmg("BWC",enemy,myHero) or 0)
  228.  
  229.                     local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  230.  
  231.                     local Sheendamage = (SheenSlot and hitdamage or 0)
  232.  
  233.                     local Trinitydamage = (TrinitySlot and hitdamage*1.5 or 0)
  234.  
  235.                     local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",enemy,myHero) or 0)
  236.  
  237.                     local combo1 = hitdamage*10 + qdamage*2 + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  238.  
  239.                     local combo2 = hitdamage*10 + Sheendamage + Trinitydamage + LichBanedamage
  240.  
  241.                     local combo3 = hitdamage*5 + Sheendamage + Trinitydamage + LichBanedamage
  242.  
  243.                     local combo4 = 0
  244.  
  245.                     if QREADY then
  246.  
  247.                             combo2 = combo2 + qdamage*2
  248.  
  249.                             combo3 = combo3 + qdamage
  250.  
  251.                             combo4 = combo4 + qdamage
  252.  
  253.                     end
  254.  
  255.                     if DFGREADY then        
  256.  
  257.                             combo1 = combo1 + dfgdamage            
  258.  
  259.                             combo2 = combo2 + dfgdamage
  260.  
  261.                             combo3 = combo3 + dfgdamage
  262.  
  263.                             combo4 = combo4 + dfgdamage
  264.  
  265.                     end
  266.  
  267.                     if HXGREADY then              
  268.  
  269.                             combo1 = combo1 + hxgdamage    
  270.  
  271.                             combo2 = combo2 + hxgdamage
  272.  
  273.                             combo3 = combo3 + hxgdamage
  274.  
  275.                             combo4 = combo4 + hxgdamage
  276.  
  277.                     end
  278.  
  279.                     if BWCREADY then
  280.  
  281.                             combo1 = combo1 + bwcdamage
  282.  
  283.                             combo2 = combo2 + bwcdamage
  284.  
  285.                             combo3 = combo3 + bwcdamage
  286.  
  287.                             combo4 = combo4 + bwcdamage
  288.  
  289.                     end
  290.  
  291.                     if IREADY and MYiConfig.autoignite then
  292.  
  293.                             combo1 = combo1 + ignitedamage
  294.  
  295.                             combo2 = combo2 + ignitedamage
  296.  
  297.                             combo3 = combo3 + ignitedamage
  298.  
  299.                             combo4 = combo4 + ignitedamage
  300.  
  301.                     end
  302.  
  303.                     if combo4 >= enemy.health then killable[calculationenemy] = 4
  304.  
  305.                     elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  306.  
  307.                     elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  308.  
  309.                     elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  310.  
  311.                     else killable[calculationenemy] = 0 end
  312.  
  313.             end
  314.  
  315.             if calculationenemy == 1 then
  316.  
  317.                     calculationenemy = heroManager.iCount
  318.  
  319.             else
  320.  
  321.                     calculationenemy = calculationenemy-1
  322.  
  323.             end
  324.  
  325.     end
  326.  
  327.     function OnDraw()
  328.  
  329.             if MYiConfig.drawcircles and not myHero.dead then
  330.  
  331.                     DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x19A712)
  332.  
  333.                     if ts.target ~= nil then
  334.  
  335.                             for j=0, 10 do
  336.  
  337.                                     DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  338.  
  339.                             end
  340.  
  341.                     end
  342.  
  343.             end
  344.  
  345.             for i=1, heroManager.iCount do
  346.  
  347.                     local enemydraw = heroManager:GetHero(i)
  348.  
  349.                     if ValidTarget(enemydraw) then
  350.  
  351.                             if MYiConfig.drawcircles then
  352.  
  353.                                     if killable[i] == 1 then
  354.  
  355.                                             for j=0, 20 do
  356.  
  357.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  358.  
  359.                                             end
  360.  
  361.                                     elseif killable[i] == 2 then
  362.  
  363.                                             for j=0, 10 do
  364.  
  365.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  366.  
  367.                                             end
  368.  
  369.                                     elseif killable[i] == 3 then
  370.  
  371.                                             for j=0, 10 do
  372.  
  373.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  374.  
  375.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  376.  
  377.                                             end
  378.  
  379.                                     elseif killable[i] == 4 then
  380.  
  381.                                             for j=0, 10 do
  382.  
  383.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  384.  
  385.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  386.  
  387.                                                     DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  388.  
  389.                                             end
  390.  
  391.                                     end
  392.  
  393.                             end
  394.  
  395.                             if MYiConfig.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  396.  
  397.                                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  398.  
  399.                             end
  400.  
  401.                     end
  402.  
  403.                     if waittxt[i] == 1 then waittxt[i] = 30
  404.  
  405.                     else waittxt[i] = waittxt[i]-1 end
  406.  
  407.             end
  408.  
  409.  
  410.     end
  411.  
  412.     function OnWndMsg(msg,key)
  413.  
  414.  
  415.     end
  416.  
  417.     function OnSendChat(msg)
  418.  
  419.  
  420.             ts:OnSendChat(msg, "pri")
  421.  
  422.     end
Advertisement
Add Comment
Please, Sign In to add comment