roach_

[1.0c] SidasAutoCarryPlugin - Wukong

Dec 21st, 2013
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3.         Auto Carry Plugin - Wukong/Monkey King Edition
  4.         Author: Roach_
  5.         Version: 1.0c
  6.         Copyright 2013
  7.  
  8.         Dependency: Sida's Auto Carry: Revamped
  9.  
  10.         How to install:
  11.             Make sure you already have AutoCarry installed.
  12.             Name the script EXACTLY "SidasAutoCarryPlugin - MonkeyKing.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14.  
  15.         Features:
  16.             Combo with Autocarry
  17.             Harass with Mixed Mode
  18.             Killsteal with Q / E
  19.             Farm with Q / E
  20.             Draw Combo Ranges (With Cooldown Check)
  21.             Escape Artist(with Flash)
  22.             Auto Pots/Items
  23.  
  24.         History:
  25.             Version: 1.0c
  26.                 Added a new Check for using Q in Harass Mode
  27.                 Fixed Harass Function(Many thanks to Sida for his ideea with the DelayedAction)
  28.                 Rewrote Low Checks Functions
  29.                 Added a new Check for Mana Potions
  30.                     - One for Harass/Farm
  31.                     - One for Potions
  32.                 Deleted Wooglets Support as an Usable Item
  33.                
  34.             Version: 1.0b
  35.                 Fixed Harass Option
  36.                 Changed the way to check if mana is low
  37.                 Added Animation Check
  38.                
  39.             Version: 1.0a
  40.                 First release
  41.  
  42. --]]
  43. if myHero.charName ~= "MonkeyKing" then return end
  44.  
  45. local Target
  46. local wEscapeHotkey = string.byte("T")
  47.  
  48. -- Prediction
  49. local qRange, eRange, rRange = 300, 625, 162
  50.  
  51. local FlashSlot = nil
  52.  
  53. local SkillQ = { spellKey = _Q, range = 300, speed = 2, delay = 0, width = 200, configName = "crushingBlow", displayName = "Q (Crushing Blow)", enabled = true, skillShot = false, minions = true, reset = true, reqTarget = false }
  54. local SkillW = { spellKey = _W, range = myHero.range-50, speed = 2, delay = 0, width = 200, configName = "decoy", displayName = "W (Decoy)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = false }
  55. local SkillE = { spellKey = _E, range = 625, speed = 2, delay = 0, width = 200, configName = "nimbusStrilke", displayName = "E (Nimbus Strike)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = true }
  56.  
  57. local QReady, WReady, EReady, RReady, FlashReady = false, false, false, false, false
  58.  
  59. -- Regeneration
  60. local UsingHPot, UsingMPot, UsingFlask, Recall = false, false, false, false
  61.  
  62. -- Our lovely script
  63. function PluginOnLoadMenu()
  64.     Menu = AutoCarry.PluginMenu
  65.     Menu2 = AutoCarry.MainMenu
  66.     Menu:addParam("wPlugin", "[Cast Options]", SCRIPT_PARAM_INFO, "")
  67.     Menu:addParam("wCombo", "[Combo Options]", SCRIPT_PARAM_INFO, "")
  68.     Menu:addParam("wAutoQ", "Auto Cast Q", SCRIPT_PARAM_ONOFF, true)
  69.     Menu:addParam("wAutoE", "Auto Cast E", SCRIPT_PARAM_ONOFF, true)
  70.     Menu:addParam("wAutoR", "Auto Cast R(When Killable)", SCRIPT_PARAM_ONOFF, false)
  71.     Menu:permaShow("wPlugin")
  72.    
  73.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  74.    
  75.     Menu:addParam("wKS", "[Kill Steal Options]", SCRIPT_PARAM_INFO, "")
  76.     Menu:addParam("wKillsteal", "Auto Kill Steal with E / Q", SCRIPT_PARAM_ONOFF, true)
  77.     Menu:permaShow("wKS")
  78.     Menu:permaShow("wKillsteal")
  79.    
  80.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  81.    
  82.     Menu:addParam("wMisc", "[Misc Options]", SCRIPT_PARAM_INFO, "")
  83.     -- Menu:addParam("wAutoLVL", "Auto Level Spells", SCRIPT_PARAM_ONOFF, false)
  84.     Menu:addParam("wMinMana", "Minimum Mana to Farm/Harass", SCRIPT_PARAM_SLICE, 40, 0, 100, -1)
  85.     Menu:addParam("wEscape", "Escape Artist", SCRIPT_PARAM_ONKEYDOWN, false, wEscapeHotkey)
  86.     Menu:addParam("wEscapeFlash", "Escape: Flash to Mouse", SCRIPT_PARAM_ONOFF, false)
  87.     Menu:permaShow("wMisc")
  88.     Menu:permaShow("wEscape")
  89.    
  90.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  91.    
  92.     Menu:addParam("wH", "[Harass Options]", SCRIPT_PARAM_INFO, "")
  93.     Menu:addParam("wHarassE", "Auto Harass with E", SCRIPT_PARAM_ONOFF, true)
  94.     Menu:addParam("wHarassQ", "Auto Harass with Q", SCRIPT_PARAM_ONOFF, false)
  95.     Menu:addParam("wHarassEscape", "Auto use W after Harass", SCRIPT_PARAM_ONOFF, false)
  96.    
  97.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  98.    
  99.     Menu:addParam("wFarm", "[Farm Options]", SCRIPT_PARAM_INFO, "")
  100.     Menu:addParam("wFarmQ", "Auto Farm with Q", SCRIPT_PARAM_ONOFF, false)
  101.     Menu:addParam("wFarmE", "Auto Clear Lane with E", SCRIPT_PARAM_ONOFF, false)
  102.    
  103.     Extras = scriptConfig("Sida's Auto Carry: "..myHero.charName.." Extras", myHero.charName)
  104.     Extras:addParam("wDraw", "[Draw Options]", SCRIPT_PARAM_INFO, "")
  105.     Extras:addParam("wDQ", "Draw Q Range", SCRIPT_PARAM_ONOFF, false)
  106.     Extras:addParam("wDW", "Draw W Range(Check Cooldowns)", SCRIPT_PARAM_ONOFF, false)
  107.     Extras:addParam("wDE", "Draw E Range", SCRIPT_PARAM_ONOFF, false)
  108.    
  109.     Extras:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  110.    
  111.     Extras:addParam("wHPMana", "[Auto Pots Options]", SCRIPT_PARAM_INFO, "")
  112.     Extras:addParam("wHP", "Auto Health Pots", SCRIPT_PARAM_ONOFF, true)
  113.     Extras:addParam("wMP", "Auto Auto Mana Pots", SCRIPT_PARAM_ONOFF, true)
  114.     Extras:addParam("wHealth", "Minimum Health for Pots", SCRIPT_PARAM_SLICE, 50, 0, 100, -1)
  115.     Extras:addParam("wMana", "Minimum Mana for Pots", SCRIPT_PARAM_SLICE, 50, 0, 100, -1)
  116. end
  117. function PluginOnLoad()
  118.     -- Params/PluginMenu
  119.     PluginOnLoadMenu()
  120.    
  121.     -- Range
  122.     AutoCarry.SkillsCrosshair.range = eRange
  123. end
  124.  
  125. function PluginOnTick()
  126.     if Recall then return end
  127.    
  128.     -- Get Attack Target
  129.     Target = AutoCarry.GetAttackTarget()
  130.  
  131.     -- Checks
  132.     wChecks()
  133.  
  134.     -- Combo, Harass, Killsteal, Escape Combo, Farm - Checks
  135.     wCombo()
  136.     wHarass()
  137.     wKillsteal()
  138.     wEscapeCombo()
  139.     wFarm()
  140.    
  141.     -- Auto Regeneration
  142.     if Extras.wHP and IsLow('Health') and not (UsingHPot or UsingFlask) and (HPReady or FSKReady) then CastSpell((hpSlot or fskSlot)) end
  143.     if Extras.wMP and IsLow('Mana') and not (UsingMPot or UsingFlask) and(MPReady or FSKReady) then CastSpell((mpSlot or fskSlot)) end
  144. end
  145.  
  146. function PluginOnDraw()
  147.     -- Draw Wukong's Range = 625
  148.     local tempColor = { 0xFF0000, 0xFF0000, 0xFF0000 }
  149.    
  150.     if not myHero.dead then
  151.         if Extras.wDQ then
  152.             if QReady then tempColor[1] = 0x00FF00 end
  153.             DrawCircle(myHero.x, myHero.y, myHero.z, qRange, tempColor[1])
  154.         end
  155.         if Extras.wDW then
  156.             if WReady then tempColor[2] = 0x00FF00 end
  157.             DrawCircle(myHero.x, myHero.y, myHero.z, myHero.range-50, tempColor[2])
  158.         end
  159.         if Extras.wDE then
  160.             if EReady then tempColor[3] = 0x00FF00 end
  161.             DrawCircle(myHero.x, myHero.y, myHero.z, eRange, tempColor[3])
  162.         end
  163.     end
  164. end
  165.  
  166. -- Spell Detection
  167. function OnProcessSpell(unit, spell)
  168.     -- Set lastSpell = Last Spell used
  169.     if unit.isMe and lastSpell ~= spell.name then
  170.         lastSpell = spell.name
  171.         PrintChat( unit.charName .. " has used: " .. spell.name )
  172.     end
  173. end
  174.  
  175. -- Object Detection
  176. function PluginOnCreateObj(obj)
  177.     if obj.name:find("TeleportHome.troy") then
  178.         if GetDistance(obj, myHero) <= 70 then
  179.             Recall = true
  180.         end
  181.     end
  182.     if obj.name:find("Regenerationpotion_itm.troy") then
  183.         if GetDistance(obj, myHero) <= 70 then
  184.             UsingHPot = true
  185.         end
  186.     end
  187.     if obj.name:find("Global_Item_HealthPotion.troy") then
  188.         if GetDistance(obj, myHero) <= 70 then
  189.             UsingHPot = true
  190.             UsingFlask = true
  191.         end
  192.     end
  193.     if obj.name:find("Global_Item_ManaPotion.troy") then
  194.         if GetDistance(obj, myHero) <= 70 then
  195.             UsingFlask = true
  196.             UsingMPot = true
  197.         end
  198.     end
  199. end
  200.  
  201. function PluginOnDeleteObj(obj)
  202.     if obj.name:find("TeleportHome.troy") then
  203.         Recall = false
  204.     end
  205.     if obj.name:find("Regenerationpotion_itm.troy") then
  206.         UsingHPot = false
  207.     end
  208.     if obj.name:find("Global_Item_HealthPotion.troy") then
  209.         UsingHPot = false
  210.         UsingFlask = false
  211.     end
  212.     if obj.name:find("Global_Item_ManaPotion.troy") then
  213.         UsingMPot = false
  214.         UsingFlask = false
  215.     end
  216. end
  217.  
  218. -- Primary Functions
  219. function wCombo()
  220.     if Menu.wCombo and Menu2.AutoCarry then
  221.         if ValidTarget(Target) then
  222.             if QReady and Menu.wAutoQ and GetDistance(Target) < qRange then
  223.                 CastSpell(SkillQ.spellKey, Target)
  224.             end
  225.            
  226.             if EReady and Menu.wAutoE and GetDistance(Target) < eRange then
  227.                 CastSpell(SkillE.spellKey, Target)
  228.             end
  229.            
  230.             if RReady and Menu.wAutoR and (getDmg("R", Target, myHero) * 4) > Target.health and GetDistance(Target) < (rRange - 12) then
  231.                 CastSpell(_R)
  232.             end
  233.         end
  234.     end
  235. end
  236.  
  237. function wHarass()
  238.     if Menu2.MixedMode then
  239.         if ValidTarget(Target) then
  240.             if Menu.wHarassE and  EReady and GetDistance(Target) < eRange and not IsLow('Mana Harass') then
  241.                 CastSpell(SkillE.spellKey, Target)
  242.             end
  243.            
  244.             if Menu.wHarassQ and QReady and GetDistance(Target) < qRange then
  245.                 CastSpell(SkillQ.spellKey, Target)
  246.                 myHero:Attack(Target)
  247.             end
  248.            
  249.             if Menu.wHarassEscape and WReady and ((isSpelling("MonkeyKingQAttack") and Menu.wHarassE and Menu.wHarassQ) or (isSpelling("MonkeyKingNimbus") and Menu.wHarassE and not Menu.wHarassQ)) then
  250.                 CastSpell(SkillW.spellKey)
  251.                 wInStealth = true
  252.                 DelayAction(function() wInStealth = false end, 1.5)
  253.             end
  254.         end
  255.     end
  256. end
  257.  
  258. function wFarm()
  259.     if Menu.wFarmQ and (Menu2.LastHit) and not IsLow('Mana Farm') then
  260.         for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  261.             if ValidTarget(minion) and QReady and GetDistance(minion) <= qRange then
  262.                 if minion.health < getDmg("Q", minion, myHero) then
  263.                     CastSpell(SkillQ.spellKey, minion)
  264.                     myHero:Attack(minion)
  265.                 end
  266.             end
  267.         end
  268.     end
  269.     if Menu.wFarmE and (Menu2.LaneClear) and not IsLow('Mana Farm') then
  270.         for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  271.             if ValidTarget(minion) and EReady and GetDistance(minion) <= eRange then
  272.                 if minion.health < getDmg("E", minion, myHero) then
  273.                     CastSpell(SkillE.spellKey, minion)
  274.                 end
  275.             end
  276.         end
  277.     end
  278. end
  279.  
  280. function wKillsteal()
  281.     if Menu.wKillsteal then
  282.         for _, enemy in pairs(AutoCarry.EnemyTable) do
  283.             if ValidTarget(enemy) then
  284.                 if QReady and GetDistance(enemy) < qRange and enemy.health < getDmg("Q", enemy, myHero) then
  285.                     CastSpell(SkillQ.spellKey, enemy)
  286.                 end
  287.                 if EReady and GetDistance(enemy) > qRange and GetDistance(enemy) < eRange and enemy.health < getDmg("E", enemy, myHero) then
  288.                     CastSpell(SkillE.spellKey, enemy)
  289.                 end
  290.             end
  291.         end
  292.     end
  293. end
  294.  
  295. function wEscapeCombo()
  296.     if Menu.wEscape then
  297.         if WReady then
  298.             CastSpell(_W)
  299.             if Menu.wEscapeFlash and FlashReady and GetDistance(mousePos) > 300 then
  300.                 CastSpell(FlashSlot, mousePos.x, mousePos.z)
  301.             end
  302.         end
  303.        
  304.         if Menu.wEscapeFlash then
  305.             myHero:MoveTo(mousePos.x, mousePos.z)
  306.         end
  307.     end
  308. end
  309.  
  310. -- Scondary Functions
  311. function wChecks()
  312.     hpSlot, mpSlot, fskSlot = GetInventorySlotItem(2003), GetInventorySlotItem(2004), GetInventorySlotItem(2041)
  313.  
  314.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  315.         FlashSlot = SUMMONER_1
  316.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  317.         FlashSlot = SUMMONER_2
  318.     end
  319.  
  320.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  321.     WReady = (myHero:CanUseSpell(_W) == READY)
  322.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  323.     RReady = (myHero:CanUseSpell(_R) == READY)
  324.     HPReady = (hpSlot ~= nil and myHero:CanUseSpell(hpSlot) == READY)
  325.     MPReady = (mpSlot ~= nil and myHero:CanUseSpell(mpSlot) == READY)
  326.     FSKReady = (fskSlot ~= nil and myHero:CanUseSpell(fskSlot) == READY)
  327.  
  328.     FlashReady = (FlashSlot ~= nil and myHero:CanUseSpell(FlashSlot) == READY)
  329.    
  330.     if wInStealth then
  331.         AutoCarry.CanAttack = false
  332.     else
  333.         AutoCarry.CanAttack = true
  334.     end
  335. end
  336.  
  337. function isSpelling(spell)
  338.     if lastSpell == spell then
  339.         return true
  340.     else
  341.         return false
  342.     end
  343. end
  344.  
  345. function IsLow(Name)
  346.     if Name == 'Mana' then
  347.         if (myHero.mana / myHero.maxMana) <= (Extras.wMana / 100) then
  348.             return true
  349.         else
  350.             return false
  351.         end
  352.     end
  353.     if Name == 'Mana Harass' or Name == 'Mana Farm' then
  354.         if (myHero.mana / myHero.maxMana) <= (Menu.wMinMana / 100) then
  355.             return true
  356.         else
  357.             return false
  358.         end
  359.     end
  360.     if Name == 'Health' then
  361.         if (myHero.health / myHero.maxHealth) <= (Extras.wWHealth / 100) then
  362.             return true
  363.         else
  364.             return false
  365.         end
  366.     end
  367. end
Advertisement
Add Comment
Please, Sign In to add comment