Advertisement
roach_

[1.0b] SidasAutoCarryPlugin - Wukong

Dec 7th, 2013
429
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.0b
  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.0b
  26.                 Fixed Harass Option
  27.                 Changed the way to check if mana is low
  28.                 Added Animation Check
  29.                
  30.             Version: 1.0a
  31.                 First release
  32.  
  33. --]]
  34. if myHero.charName ~= "MonkeyKing" then return end
  35.  
  36. local Target
  37. local wEscapeHotkey = string.byte("T")
  38.  
  39. -- Prediction
  40. local qRange, eRange, rRange = 300, 625, 162
  41.  
  42. local FlashSlot = nil
  43.  
  44. local SkillQ = {spellKey = _Q, range = qRange, speed = 2, delay = 0, width = 200, configName = "crushingBlow", displayName = "Q (Crushing Blow)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = true }
  45. local SkillE = {spellKey = _E, range = eRange, speed = 2, delay = 0, width = 200, configName = "nimbusStrike", displayName = "E (Nimbus Strike)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = true }
  46.  
  47. local QReady, WReady, EReady, RReady, FlashReady = false, false, false, false, false
  48.  
  49. -- Regeneration
  50. local UsingHPot, UsingMPot, UsingFlask, Recall = false, false, false, false
  51.  
  52. -- Our lovely script
  53. function PluginOnLoadMenu()
  54.     Menu = AutoCarry.PluginMenu
  55.     Menu2 = AutoCarry.MainMenu
  56.     Menu:addParam("wPlugin", "[Cast Options]", SCRIPT_PARAM_INFO, "")
  57.     Menu:addParam("wCombo", "[Combo Options]", SCRIPT_PARAM_INFO, "")
  58.     Menu:addParam("wAutoQ", "Auto Cast Q", SCRIPT_PARAM_ONOFF, true)
  59.     Menu:addParam("wAutoE", "Auto Cast E", SCRIPT_PARAM_ONOFF, true)
  60.     Menu:addParam("wAutoR", "Auto Cast R(When Killable)", SCRIPT_PARAM_ONOFF, false)
  61.     Menu:permaShow("wPlugin")
  62.    
  63.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  64.    
  65.     Menu:addParam("wKS", "[Kill Steal Options]", SCRIPT_PARAM_INFO, "")
  66.     Menu:addParam("wKillsteal", "Auto Kill Steal with E / Q", SCRIPT_PARAM_ONOFF, true)
  67.     Menu:permaShow("wKS")
  68.     Menu:permaShow("wKillsteal")
  69.    
  70.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  71.    
  72.     Menu:addParam("wMisc", "[Misc Options]", SCRIPT_PARAM_INFO, "")
  73.     -- Menu:addParam("pAutoLVL", "Auto Level Spells", SCRIPT_PARAM_ONOFF, false)
  74.     Menu:addParam("wMinMana", "Minimum Mana to Farm/Harass", SCRIPT_PARAM_SLICE, 40, 0, 100, -1)
  75.     Menu:addParam("wEscape", "Escape Artist", SCRIPT_PARAM_ONKEYDOWN, false, wEscapeHotkey)
  76.     Menu:addParam("wEscapeFlash", "Escape: Flash to Mouse", SCRIPT_PARAM_ONOFF, false)
  77.     Menu:permaShow("wMisc")
  78.     Menu:permaShow("wEscape")
  79.    
  80.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  81.    
  82.     Menu:addParam("wH", "[Harass Options]", SCRIPT_PARAM_INFO, "")
  83.     Menu:addParam("wHarass", "Auto Harass with E", SCRIPT_PARAM_ONOFF, true)
  84.     Menu:addParam("wHarassEscape", "Auto use W after Harass", SCRIPT_PARAM_ONOFF, false)
  85.    
  86.     Menu:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  87.    
  88.     Menu:addParam("wFarm", "[Farm Options]", SCRIPT_PARAM_INFO, "")
  89.     Menu:addParam("wFarmQ", "Auto Farm with Q", SCRIPT_PARAM_ONOFF, false)
  90.     Menu:addParam("wFarmE", "Auto Clear Lane with E", SCRIPT_PARAM_ONOFF, false)
  91.    
  92.     Extras = scriptConfig("Sida's Auto Carry Plugin: "..myHero.charName..": Extras", myHero.charName)
  93.     Extras:addParam("wDraw", "[Draw Options]", SCRIPT_PARAM_INFO, "")
  94.     Extras:addParam("wDQ", "Draw Q Range", SCRIPT_PARAM_ONOFF, false)
  95.     Extras:addParam("wDW", "Draw W Range(Check Cooldowns)", SCRIPT_PARAM_ONOFF, false)
  96.     Extras:addParam("wDE", "Draw E Range", SCRIPT_PARAM_ONOFF, false)
  97.    
  98.     Extras:addParam("wGap", "", SCRIPT_PARAM_INFO, "")
  99.    
  100.     Extras:addParam("wHPMana", "[Auto Pots/Items Options]", SCRIPT_PARAM_INFO, "")
  101.     Extras:addParam("wWItem", "Auto Wooglets", SCRIPT_PARAM_ONOFF, true)
  102.     Extras:addParam("wWHealth", "Minimum Health for Wooglets", SCRIPT_PARAM_SLICE, 15, 0, 100, -1)
  103.     Extras:addParam("wHP", "Auto Health Pots", SCRIPT_PARAM_ONOFF, true)
  104.     Extras:addParam("wMP", "Auto Auto Mana Pots", SCRIPT_PARAM_ONOFF, true)
  105.     Extras:addParam("wHPHealth", "Minimum Health for Pots", SCRIPT_PARAM_SLICE, 50, 0, 100, -1)
  106. end
  107. function PluginOnLoad()
  108.     -- Params/PluginMenu
  109.     PluginOnLoadMenu()
  110.    
  111.     -- Range
  112.     AutoCarry.SkillsCrosshair.range = eRange-25
  113. end
  114.  
  115. function PluginOnTick()
  116.     if Recall then return end
  117.  
  118.     -- Get Attack Target
  119.     Target = AutoCarry.GetAttackTarget()
  120.  
  121.     -- Check Spells
  122.     wSpellCheck()
  123.  
  124.     -- Combo, Harass, Killsteal, Escape Combo, Farm - Checks
  125.     wCombo()
  126.     wHarass()
  127.     wKillsteal()
  128.     wEscapeCombo()
  129.     wFarm()
  130.    
  131.     -- Auto Regeneration
  132.     if Extras.wWItem and IsMyHealthLow() and Target and WGTReady then CastSpell(wgtSlot) end
  133.     if Extras.wHP and NeedHP() and not (UsingHPot or UsingFlask) and (HPReady or FSKReady) then CastSpell((hpSlot or fskSlot)) end
  134.     if Extras.wMP and IsMyManaLow() and not (UsingMPot or UsingFlask) and(MPReady or FSKReady) then CastSpell((mpSlot or fskSlot)) end
  135. end
  136.  
  137. function PluginOnDraw()
  138.     -- Draw Wukong's Range = 625 - 25
  139.     local tempColor = { 0xFF0000, 0xFF0000, 0xFF0000 }
  140.    
  141.     if not myHero.dead then
  142.         if Extras.wDQ then
  143.             if QReady then tempColor[1] = 0x00FF00 end
  144.             DrawCircle(myHero.x, myHero.y, myHero.z, qRange, tempColor[1])
  145.         end
  146.         if Extras.wDW then
  147.             if WReady then tempColor[2] = 0x00FF00 end
  148.             DrawCircle(myHero.x, myHero.y, myHero.z, myHero.range-50, tempColor[2])
  149.         end
  150.         if Extras.wDE then
  151.             if EReady then tempColor[3] = 0x00FF00 end
  152.             DrawCircle(myHero.x, myHero.y, myHero.z, eRange, tempColor[3])
  153.         end
  154.     end
  155. end
  156.  
  157. -- Animation Detection
  158. function PluginOnAnimation(unit, animationName)
  159.     -- Set lastAnimation = Last Animation used
  160.     if unit.isMe and lastAnimation ~= animationName then lastAnimation = animationName end
  161. end
  162.  
  163. -- Object Detection
  164. function PluginOnCreateObj(obj)
  165.     if obj.name:find("TeleportHome.troy") then
  166.         if GetDistance(obj, myHero) <= 70 then
  167.             Recall = true
  168.         end
  169.     end
  170.     if obj.name:find("Regenerationpotion_itm.troy") then
  171.         if GetDistance(obj, myHero) <= 70 then
  172.             UsingHPot = true
  173.         end
  174.     end
  175.     if obj.name:find("Global_Item_HealthPotion.troy") then
  176.         if GetDistance(obj, myHero) <= 70 then
  177.             UsingHPot = true
  178.             UsingFlask = true
  179.         end
  180.     end
  181.     if obj.name:find("Global_Item_ManaPotion.troy") then
  182.         if GetDistance(obj, myHero) <= 70 then
  183.             UsingFlask = true
  184.             UsingMPot = true
  185.         end
  186.     end
  187. end
  188.  
  189. function PluginOnDeleteObj(obj)
  190.     if obj.name:find("TeleportHome.troy") then
  191.         Recall = false
  192.     end
  193.     if obj.name:find("Regenerationpotion_itm.troy") then
  194.         UsingHPot = false
  195.     end
  196.     if obj.name:find("Global_Item_HealthPotion.troy") then
  197.         UsingHPot = false
  198.         UsingFlask = false
  199.     end
  200.     if obj.name:find("Global_Item_ManaPotion.troy") then
  201.         UsingMPot = false
  202.         UsingFlask = false
  203.     end
  204. end
  205.  
  206. -- Primary Functions
  207. function wCombo()
  208.     if Menu.wCombo and Menu2.AutoCarry then
  209.         if ValidTarget(Target) then
  210.             if QReady and Menu.wAutoQ and GetDistance(Target) < qRange then
  211.                 CastSpell(SkillQ.spellKey, Target)
  212.             end
  213.            
  214.             if EReady and Menu.wAutoE and GetDistance(Target) < eRange then
  215.                 CastSpell(SkillE.spellKey, Target)
  216.             end
  217.            
  218.             if RReady and Menu.wAutoR and (getDmg("R", Target, myHero) * 4) > Target.health and GetDistance(Target) < (rRange - 12) then
  219.                 CastSpell(_R)
  220.             end
  221.         end
  222.     end
  223. end
  224.  
  225. function wHarass()
  226.     if Menu.wHarass and Menu2.MixedMode then
  227.         if ValidTarget(Target) then
  228.             if EReady and GetDistance(Target) < eRange and not IsMyManaLow() then
  229.                 CastSpell(SkillE.spellKey, Target)
  230.             end
  231.            
  232.             if WReady and isChanneling("Spell3") and Menu.wHarassEscape then
  233.                 CastSpell(_W)
  234.             end
  235.         end
  236.     end
  237. end
  238.  
  239. function wFarm()
  240.     if Menu.wFarmQ and (Menu2.LastHit) and not IsMyManaLow() then
  241.         for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  242.             if ValidTarget(minion) and QReady and GetDistance(minion) <= qRange then
  243.                 if minion.health < getDmg("Q", minion, myHero) then
  244.                     CastSpell(SkillQ.spellKey, minion)
  245.                 end
  246.             end
  247.         end
  248.     end
  249.     if Menu.wFarmE and (Menu2.LaneClear) and not IsMyManaLow() then
  250.         for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  251.             if ValidTarget(minion) and EReady and GetDistance(minion) <= eRange then
  252.                 if minion.health < getDmg("E", minion, myHero) then
  253.                     CastSpell(SkillE.spellKey, minion)
  254.                 end
  255.             end
  256.         end
  257.     end
  258. end
  259.  
  260. function wKillsteal()
  261.     if Menu.wKillsteal then
  262.         for _, enemy in pairs(AutoCarry.EnemyTable) do
  263.             if ValidTarget(enemy) then
  264.                 if QReady and GetDistance(enemy) < qRange and enemy.health < getDmg("Q", enemy, myHero) then
  265.                     CastSpell(SkillQ.spellKey, enemy)
  266.                 end
  267.                 if EReady and GetDistance(enemy) > qRange and GetDistance(enemy) < eRange and enemy.health < getDmg("E", enemy, myHero) then
  268.                     CastSpell(SkillE.spellKey, enemy)
  269.                 end
  270.             end
  271.         end
  272.     end
  273. end
  274.  
  275. function wEscapeCombo()
  276.     if Menu.wEscape then
  277.         if WReady then
  278.             CastSpell(_W)
  279.             if Menu.wEscapeFlash and FlashReady and GetDistance(mousePos) > 300 then
  280.                 CastSpell(FlashSlot, mousePos.x, mousePos.z)
  281.             end
  282.         end
  283.        
  284.         if Menu.wEscapeFlash then
  285.             myHero:MoveTo(mousePos.x, mousePos.z)
  286.         end
  287.     end
  288. end
  289.  
  290. -- Scondary Functions
  291. function wSpellCheck()
  292.     wgtSlot = GetInventorySlotItem(3090)
  293.     hpSlot, mpSlot, fskSlot = GetInventorySlotItem(2003),GetInventorySlotItem(2004),GetInventorySlotItem(2041)
  294.  
  295.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  296.         FlashSlot = SUMMONER_1
  297.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  298.         FlashSlot = SUMMONER_2
  299.     end
  300.  
  301.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  302.     WReady = (myHero:CanUseSpell(_W) == READY)
  303.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  304.     RReady = (myHero:CanUseSpell(_R) == READY)
  305.     WGTReady = (wgtSlot ~= nil and myHero:CanUseSpell(wgtSlot) == READY)
  306.     HPReady = (hpSlot ~= nil and myHero:CanUseSpell(hpSlot) == READY)
  307.     MPReady = (mpSlot ~= nil and myHero:CanUseSpell(mpSlot) == READY)
  308.     FSKReady = (fskSlot ~= nil and myHero:CanUseSpell(fskSlot) == READY)
  309.  
  310.     FlashReady = (FlashSlot ~= nil and myHero:CanUseSpell(FlashSlot) == READY)
  311. end
  312.  
  313. function isChanneling(animationName)
  314.     if lastAnimation == animationName then
  315.         return true
  316.     else
  317.         return false
  318.     end
  319. end
  320.  
  321. -- Auto Potions
  322. function IsMyManaLow()
  323.     if (myHero.mana / myHero.maxMana) <= (Menu.wMinMana / 100) then
  324.         return true
  325.     else
  326.         return false
  327.     end
  328. end
  329.  
  330. function IsMyHealthLow()
  331.     if (myHero.health / myHero.maxHealth) <= (Extras.wWHealth / 100) then
  332.         return true
  333.     else
  334.         return false
  335.     end
  336. end
  337.  
  338. function NeedHP()
  339.     if (myHero.health / myHero.maxHealth) <= (Extras.wHPHealth / 100) then
  340.         return true
  341.     else
  342.         return false
  343.     end
  344. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement