16HeX16

Poppy Helper 1.2

Mar 30th, 2013
2,543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.07 KB | None | 0 0
  1. --[[    Poppy Helper 1.2 by HeX ]]--
  2. if myHero.charName ~= "Poppy" then return end
  3.  
  4. require "MapPosition"
  5.  
  6. --[[    Code    ]]--
  7. local stunDistance = 300
  8. local Erange = 525
  9. local Qrange = 250
  10. local Rrange = 600
  11. local WeakestEnemy = nil
  12. --[[    Attacks ]]--
  13. local lastBasicAttack = 0
  14. local swingDelay = 0.25
  15. local startAttackSpeed = 0.625
  16. local swing = 0
  17. --[[    Ready   ]]--
  18. local ignite = nil
  19. local QREADY, WREADY, EREADY, RREADY  = false, false, false, false
  20. local BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot = nil, nil, nil, nil, nil, nil, nil
  21. local QREADY, WREADY, EREADY, RREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY, TMTREADY, RAHREADY, RNDREADY = false, false, false, false, false, false, false, false, false, false, false
  22.  
  23. function OnLoad()
  24.     PrintChat("<font color='#CCCCCC'> >> Poppy Helper 1.2 loaded! <<</font>")
  25.     PSConfig = scriptConfig("Poppy Stun", "PoppyStun")
  26.     PSConfig:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  27.     PSConfig:addParam("scriptActive", "Burst Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  28.     PSConfig:addParam("TeamFight", "Team Fight", SCRIPT_PARAM_ONKEYDOWN, false, 88)
  29.     PSConfig:addParam("autoStun", "Auto-Stun", SCRIPT_PARAM_ONKEYTOGGLE, true, 67)
  30.     PSConfig:addParam("autoignite", "Ignite when Killable", SCRIPT_PARAM_ONOFF, true)
  31.     PSConfig:addParam("stunCircle", "Auto-Stun - Arrow", SCRIPT_PARAM_ONOFF, true)
  32.     PSConfig:permaShow("Harass")
  33.     PSConfig:permaShow("scriptActive")
  34.     PSConfig:permaShow("TeamFight")
  35.     PSConfig:permaShow("autoStun")
  36.     mapPosition = MapPosition()
  37.     ts = TargetSelector(TARGET_LOW_HP, Erange+50, DAMAGE_MAGIC)
  38.     ts.name = "Poppy"
  39.     PSConfig:addTS(ts)
  40.     LastBasicAttack = os.clock()
  41.    
  42.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  43.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  44.     end
  45. end
  46.  
  47. function OnTick()
  48.     ts:update()
  49.    
  50.     AttackDelay = (600/(myHero.attackSpeed/(1/startAttackSpeed)))/1000
  51.     if swing == 1 and os.clock() > lastBasicAttack + AttackDelay then
  52.         swing = 0
  53.     end
  54.    
  55.     BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3077), GetInventorySlotItem(3074),  GetInventorySlotItem(3143)
  56.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  57.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  58.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  59.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  60.     TMTREADY = (TMTSlot ~= nil and myHero:CanUseSpell(TMTSlot) == READY)
  61.     RAHREADY = (RAHSlot ~= nil and myHero:CanUseSpell(RAHSlot) == READY)
  62.     RNDREADY = (RNDSlot ~= nil and myHero:CanUseSpell(RNDSlot) == READY)
  63.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  64.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  65.     WREADY = (myHero:CanUseSpell(_W) == READY)
  66.     EREADY = (myHero:CanUseSpell(_E) == READY)
  67.     RREADY = (myHero:CanUseSpell(_R) == READY)
  68.    
  69.     --[[    Harass  ]]--
  70.     if PSConfig.Harass and ts.target ~= nil then
  71.         local QDMG = getDmg("Q", ts.target, myHero)
  72.         --[[    Attacks ]]--
  73.         if swing == 0  then
  74.             if GetDistance(ts.target) < 400 then
  75.                 myHero:Attack(ts.target)
  76.                 elseif QREADY and ts.target.health < QDMG and GetDistance(ts.target) < Erange then
  77.                     CastSpell(_Q)
  78.                     Attack(ts.target)
  79.                     swing = 0
  80.             end
  81.             elseif swing == 1 then
  82.             if QREADY and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) < Qrange then
  83.                 CastSpell(_Q)
  84.                 myHero:Attack(ts.target)
  85.                 swing = 0
  86.             end
  87.         end
  88.     end
  89.    
  90.     --[[    Burst Combo ]]--
  91.     if PSConfig.scriptActive and ts.target ~= nil then
  92.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  93.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  94.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  95.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  96.         if TMTREADY and GetDistance(ts.target) < 275 then CastSpell(TMTSlot) end
  97.         if RAHREADY and GetDistance(ts.target) < 275 then CastSpell(RAHSlot) end
  98.         if RNDREADY and GetDistance(ts.target) < 275 then CastSpell(RNDSlot) end
  99.         if RREADY and GetDistance(ts.target) < Rrange then CastSpell(_R, ts.target) end
  100.         if WREADY and GetDistance(ts.target) < Erange then CastSpell(_W) end
  101.         local QDMG = getDmg("Q", ts.target, myHero)
  102.         --[[    Attacks ]]--
  103.         if swing == 0  then
  104.             if GetDistance(ts.target) < Erange then
  105.                 myHero:Attack(ts.target)
  106.                 elseif QREADY and ts.target.health < QDMG then
  107.                     CastSpell(_Q)
  108.                     Attack(ts.target)
  109.                     swing = 0
  110.             end
  111.             elseif swing == 1 then
  112.             if QREADY and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) < Qrange then
  113.                 CastSpell(_Q)
  114.                 myHero:Attack(ts.target)
  115.                 swing = 0
  116.             end
  117.         end
  118.     end
  119.    
  120.     --[[    Team Fight  ]]--
  121.     if PSConfig.TeamFight and ts.target ~= nil then
  122.         findWeakest()
  123.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  124.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  125.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  126.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  127.         if TMTREADY and GetDistance(ts.target) < 275 then CastSpell(TMTSlot) end
  128.         if RAHREADY and GetDistance(ts.target) < 275 then CastSpell(RAHSlot) end
  129.         if RNDREADY and GetDistance(ts.target) < 275 then CastSpell(RNDSlot) end
  130.         if WeakestEnemy ~= nil then
  131.             if RREADY and GetDistance(WeakestEnemy) < Rrange then CastSpell(_R, WeakestEnemy) end
  132.         end
  133.         if WREADY and GetDistance(ts.target) < Erange then CastSpell(_W) end
  134.         local QDMG = getDmg("Q", ts.target, myHero)
  135.         --[[    Attacks ]]--
  136.         if swing == 0  then
  137.             if GetDistance(ts.target) < Erange then
  138.                 myHero:Attack(ts.target)
  139.                 elseif QREADY and ts.target.health < QDMG then
  140.                     CastSpell(_Q)
  141.                     Attack(ts.target)
  142.                     swing = 0
  143.             end
  144.             elseif swing == 1 then
  145.             if QREADY and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) < Qrange then
  146.                 CastSpell(_Q)
  147.                 myHero:Attack(ts.target)
  148.                 swing = 0
  149.             end
  150.         end
  151.     end
  152.    
  153.     --[[    Auto Stun   ]]--
  154.     if myHero:GetSpellData(_E).level > 0 then
  155.         StunPos = nil
  156.         for i=1, heroManager.iCount do
  157.             Target = heroManager:getHero(i)
  158.             if ValidCheck(Target) and GetDistance(Target) <= Erange then
  159.                 if (PSConfig.autoStun or PSConfig.scriptActive) and EREADY and AgainstWall(Target) then
  160.                     if GetDistance(Target) <= Erange then
  161.                         CastSpell(_E, Target)
  162.                     end
  163.                 end
  164.             end
  165.         end
  166.     end
  167.    
  168.     --[[    Auto Ignite ]]--
  169.     if PSConfig.autoignite then    
  170.         if IREADY then
  171.             local ignitedmg = 0    
  172.             for i = 1, heroManager.iCount, 1 do
  173.                 local enemyhero = heroManager:getHero(i)
  174.                 if ValidTarget(enemyhero,600) then
  175.                     ignitedmg = 50 + 20 * myHero.level
  176.                     if enemyhero.health <= ignitedmg then
  177.                         CastSpell(ignite, enemyhero)
  178.                     end
  179.                 end
  180.             end
  181.         end
  182.     end
  183. end
  184.  
  185. function OnDraw()
  186.     if not myHero.dead and PSConfig.stunCircle then
  187.         if Target ~= nil and EREADY and StunPos ~= nil then
  188.             DrawArrows(TargetPos, StunPos, 80, 0x00FFFF, 80)
  189.         end
  190.     end
  191. end
  192.  
  193. function AgainstWall(Enemy)
  194.     TargetPos = Vector(Enemy.x, Enemy.y, Enemy.z)
  195.     MyPos = Vector(myHero.x, myHero.y, myHero.z)
  196.     StunPos = TargetPos + (TargetPos - MyPos)*((stunDistance/GetDistance(Enemy)))
  197.   if StunPos ~= nil and mapPosition:intersectsWall(Point(StunPos.x, StunPos.z)) then
  198.         return true
  199.     end
  200. end
  201.  
  202. function ValidCheck(Unit)
  203.     if Unit ~= nil and Unit.type == "obj_AI_Hero" and not Unit.dead and myHero.team ~= Unit.team and Unit.visible then
  204.         return true
  205.     end
  206. end
  207.  
  208. function findWeakest()
  209.     WeakestEnemy = nil
  210.     for i = 1, heroManager.iCount, 1 do
  211.         local enemyhero = heroManager:getHero(i)
  212.         if enemyhero ~= nil and enemyhero.team ~= myHero.team and not enemyhero.invulnerable and GetDistance(enemyhero) <= 1000 then
  213.             if WeakestEnemy == nil then
  214.                 WeakestEnemy = enemyhero
  215.             elseif ((WeakestEnemy.addDamage+WeakestEnemy.ap)>(enemyhero.addDamage+enemyhero.ap)) then
  216.                 WeakestEnemy = enemyhero
  217.             end                            
  218.         end
  219.     end
  220. end
  221.  
  222. function OnProcessSpell(unit, spell)
  223.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  224.         swing = 1
  225.         lastBasicAttack = os.clock()
  226.     end
  227. end
Advertisement
Add Comment
Please, Sign In to add comment