Kain2030

Auto Carry Plugin - Teemo Edition - v1.2b

Aug 24th, 2013
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.01 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Teemo Edition
  4.         Author: Kain
  5.         Version: 1.2b
  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 - Teemo.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14.  
  15.         Features:
  16.             Shroom Bomb
  17.             Escape Wizard
  18.             Shroom Placement Helper for Summoner's Rift
  19.             Range Circle
  20.  
  21.         History:
  22.             Version: 1.2b: http://pastebin.com/gYGpNTeN
  23.                 Updated to Kilua's Teemo Hack v1.5.
  24.             Version: 1.1m: http://pastebin.com/YFFsVUDK
  25.             Version: 1.1k: http://pastebin.com/GbBiCDYY
  26.                 Added Shroom Hack.
  27.                 Code cleanup.
  28.                 Changed method for displaying text on screen.
  29.                 Shroom settings changes now auto refresh without an F9.
  30.             Version: 1.05e: http://pastebin.com/nFXpw9tX
  31.                 Fixed "Blinding Dart" range to 680.
  32.                 Fixed "Shroom Bomb" not firing.
  33.                 Added on screen text to indicate when "Shroom Bomb" occurs.
  34.                 Made improvements to target detection. Will not shoot at Kog'maw passive, Karthus, etc.
  35.                 Fixed issue with Q not working sometimes.
  36.             Version: 1.04: http://pastebin.com/EjLX4Vrq
  37.                 Added support for more items.
  38.             Version: 1.03: http://pastebin.com/GGWEjni1
  39.                 Fixed shrooms snapping/magnetism. Added toggle for this.
  40.                 Added more ranges; changed colors.
  41.                 Added experimental flash during escape toggle option. Off by default.
  42.  
  43.             Version: 1.02: http://pastebin.com/uJ2p7aaQ
  44.                 Random Fixes
  45. --]]
  46.  
  47. if myHero.charName ~= "Teemo" then return end
  48.  
  49. local Target
  50. local EscapeHotkey = string.byte("T")
  51.  
  52. -- Prediction
  53. local QRange = 680
  54. local RRange = 230
  55.  
  56. local SkillQ = {spellKey = _Q, range = QRange, speed = 2, delay = 0, width = 200, configName = "blindingDart", displayName = "Q (Blinding Dart)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = true }
  57. local SkillW = {spellKey = _W, range = 0, speed = 2, delay = 0}
  58. local SkillR = {spellKey = _R, range = RRange, speed = 2, delay = 0}
  59.  
  60. local DFGSlot, HXGSlot, BWCSlot, BRKSlot, FlashSlot = nil, nil, nil, nil, nil
  61. local QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, BRKReady, FlashReady = false, false, false, false, false, false, false, false, false
  62.  
  63. local debugMode = false
  64.  
  65. -- Shrooms Config
  66. local highEnabled     = nil -- Enable High Priority Mushrooms
  67. local medEnabled      = nil -- Enable Medium Priority Mushrooms
  68. local lowEnabled      = nil -- Enable Low Priority Mushrooms
  69. local blueEnabled     = nil -- Enable Blue Team Mushrooms (in and around blue jungle)
  70. local purpEnabled     = nil -- Enable Purple Team Mushrooms (in and around purple jungle)
  71.  
  72. local shroomSpots     = nil
  73.  
  74. local showLocationsInRange = 3000 -- When you press R, locations in this range will be shown
  75. local showClose = true -- Show shroom locations that are close to you
  76. local showCloseRange = 800
  77.  
  78. local FlashSlot = nil
  79.  
  80. -- Keep track of settings changes
  81. local snapShrooms = nil
  82. local autoShroomsHigh = nil
  83. local autoShroomsMedium = nil
  84.  
  85. -- Shroom Hack
  86. local nbStack = nil
  87. local NextShroomTime = nil
  88. local BaseTime
  89. local CDTime
  90. local recall = false
  91.  
  92. -- Main
  93.  
  94. function Menu()
  95.     AutoCarry.PluginMenu:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  96.     AutoCarry.PluginMenu:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  97.     AutoCarry.PluginMenu:addParam("Escape", "Escape Artist", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  98.     AutoCarry.PluginMenu:addParam("EscapeFlash", "Escape: Flash to Mouse", SCRIPT_PARAM_ONOFF, false)
  99.     AutoCarry.PluginMenu:addParam("Ultimate", "Use Shroom Bomb with combo", SCRIPT_PARAM_ONOFF, true)
  100.     AutoCarry.PluginMenu:addParam("DrawShrooms", "Shroom Placement Helper", SCRIPT_PARAM_ONOFF, true)
  101.     AutoCarry.PluginMenu:addParam("SnapShrooms", "Snap Shrooms into place", SCRIPT_PARAM_ONOFF, true)
  102.     if VIP_USER then
  103.         AutoCarry.PluginMenu:addParam("ShroomHack", "Extra Shrooms Hack", SCRIPT_PARAM_ONOFF, true)
  104.     end
  105.     AutoCarry.PluginMenu:addParam("AutoShroomsHigh", "Auto-shroom high priority locations", SCRIPT_PARAM_ONOFF, true)
  106.     AutoCarry.PluginMenu:addParam("AutoShroomsMedium", "Auto-shroom medium priority locations", SCRIPT_PARAM_ONOFF, false)
  107.     AutoCarry.PluginMenu:addParam("Draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
  108. end
  109.  
  110. function ShroomConfig()
  111.     highEnabled = AutoCarry.PluginMenu.DrawShrooms
  112.     medEnabled  = AutoCarry.PluginMenu.DrawShrooms
  113.     lowEnabled  = AutoCarry.PluginMenu.DrawShrooms
  114.     blueEnabled = AutoCarry.PluginMenu.DrawShrooms
  115.     purpEnabled = AutoCarry.PluginMenu.DrawShrooms
  116. end
  117.  
  118. function PluginOnLoad()
  119.     if VIP_USER then
  120.         AddRecvPacketCallback(OnRecvPacket)
  121.     end
  122.  
  123.     Menu()
  124.     ShroomConfig()
  125.     InitializeShrooms()
  126. end
  127.  
  128. function PluginOnTick()
  129.     Target = AutoCarry.GetAttackTarget()
  130.  
  131.     CheckSettingsChange()
  132.  
  133.     if VIP_USER then ShroomHackOnTick() end
  134.  
  135.     SpellCheck()
  136.  
  137.     if AutoCarry.PluginMenu.Combo then
  138.         Combo()
  139.     end
  140.  
  141.     if AutoCarry.PluginMenu.Harass then
  142.         Harass()
  143.     end
  144.  
  145.     if AutoCarry.PluginMenu.Escape then
  146.         EscapeCombo()
  147.     end
  148.  
  149.     -- Shrooms
  150.     PlaceAutoShrooms()
  151. end
  152.  
  153. function CheckSettingsChange()
  154.     -- Re-Initalize Shrooms settings if user changes them.
  155.     if snapShrooms == nil or snapShrooms ~= AutoCarry.PluginMenu.SnapShrooms
  156.         or autoShroomsHigh == nil or autoShroomsHigh ~= AutoCarry.PluginMenu.AutoShroomsHigh
  157.         or autoShroomsMedium == nil or autoShroomsMedium ~= AutoCarry.PluginMenu.AutoShroomsMedium then
  158.         snapShrooms = AutoCarry.PluginMenu.SnapShrooms
  159.         autoShroomsHigh = AutoCarry.PluginMenu.AutoShroomsHigh
  160.         autoShroomsMedium = AutoCarry.PluginMenu.AutoShroomsMedium
  161.         InitializeShrooms()
  162.     end
  163. end
  164.  
  165. function PluginOnProcessSpell(unit, spell)
  166.     if VIP_USER then ShroomHackOnProcessSpell(unit, spell) end
  167. end
  168.  
  169. function Combo()
  170.     if Target ~= nil and not Target.dead then
  171.         CastSlots()
  172.  
  173.         if QReady and GetDistance(Target) < QRange then
  174.             if not AutoCarry.GetCollision(SkillQ, myHero, Target) then
  175.                 CastSpell(SkillQ.spellKey, Target)
  176.             end
  177.         end
  178.  
  179.         -- Shroom under enemy
  180.         ShroomUnderEnemy()
  181.     end
  182. end
  183.  
  184. function EscapeCombo()
  185.     if WReady then
  186.         AutoCarry.CastSpell(SkillW.spellKey)
  187.     end
  188.  
  189.     if RReady then
  190.         CastSpell(SkillR.spellKey, myHero.x, myHero.z)
  191.     end
  192.  
  193.     if AutoCarry.PluginMenu.EscapeFlash and FlashSlot ~= nil and FlashReady and GetDistance(mousePos) > 300 then
  194.         CastSpell(FlashSlot, mousePos.x, mousePos.z)
  195.     end
  196.  
  197.     if AutoCarry.PluginMenu.EscapeFlash then
  198.         myHero:MoveTo(mousePos.x, mousePos.z)
  199.     end
  200. end
  201.  
  202. function Harass()
  203.     if Target ~= nil and not Target.dead then
  204.         if QReady and GetDistance(Target) < QRange then
  205.             CastSpell(SkillQ.spellKey, Target)
  206.             myHero:Attack(Target)
  207.         end
  208.     end
  209. end
  210.  
  211. function SpellCheck()
  212.     DFGSlot, HXGSlot, BWCSlot, BRKSlot = GetInventorySlotItem(3128),
  213.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3153)
  214.  
  215.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  216.         FlashSlot = SUMMONER_1
  217.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  218.         FlashSlot = SUMMONER_2
  219.     end
  220.  
  221.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  222.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  223.     EReady = (myHero:CanUseSpell(_E) == READY)
  224.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  225.  
  226.     DFGReady   = (DFGSlot   ~= nil and myHero:CanUseSpell(DFGSlot)   == READY)
  227.     HXGReady   = (HXGSlot   ~= nil and myHero:CanUseSpell(HXGSlot)   == READY)
  228.     BWCReady   = (BWCSlot   ~= nil and myHero:CanUseSpell(BWCSlot)   == READY)
  229.     BRKReady   = (BRKSlot   ~= nil and myHero:CanUseSpell(BRKSlot)   == READY)
  230.     FlashReady = (FlashSlot ~= nil and myHero:CanUseSpell(FlashSlot) == READY)
  231. end
  232.  
  233. function CastSlots()
  234.     if Target ~= nil and not Target.dead then
  235.         if GetDistance(Target) <= QRange then
  236.             if DFGReady then CastSpell(DFGSlot, Target) end
  237.             if HXGReady then CastSpell(HXGSlot, Target) end
  238.             if BWCReady then CastSpell(BWCSlot, Target) end
  239.             if BRKReady then CastSpell(BRKSlot, Target) end
  240.         end
  241.     end
  242. end
  243.  
  244. function ShroomUnderEnemy()
  245.     if AutoCarry.PluginMenu.Ultimate and RReady and Target ~= nil and GetDistance(Target) < RRange then
  246.         if not shroomExists(shroomSpot) then
  247.             -- Message.AddMessage("Shroom Bomb!", ColorARGB.Green, myHero)
  248.             PrintFloatText(myHero, 10, "Shroom Bomb!")
  249.             AutoCarry.CastSkillshot(SkillR, Target)
  250.             return true
  251.         end
  252.     end
  253.  
  254.     return false
  255. end
  256.  
  257. function PlaceAutoShrooms()
  258.     if not shroomSpots then return end
  259.  
  260.     for i,group in pairs(shroomSpots) do
  261.         for x, shroomSpot in pairs(group.Locations) do
  262.             if group.Enabled and group.Auto and GetDistance(shroomSpot) <= 250 and not shroomExists(shroomSpot) then
  263.                 CastSpell(SkillR.spellKey, shroomSpot.x, shroomSpot.z)
  264.             end
  265.         end
  266.     end
  267. end
  268.  
  269. function PluginOnDraw()
  270.     -- Draw Ranges
  271.     if AutoCarry.PluginMenu.Draw then
  272.         DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x808080) -- Gray
  273.  
  274.         if QReady then
  275.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x0099CC) -- Blue
  276.         end
  277.  
  278.         if RReady then
  279.             DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000) -- Red
  280.         end
  281.     end
  282.  
  283.     -- Draw Shrooms
  284.     if AutoCarry.PluginMenu.DrawShrooms and shroomSpots then
  285.         for i,group in pairs(shroomSpots) do
  286.             if group.Enabled == true then
  287.                 if drawShroomSpots then
  288.                     for x, shroomSpot in pairs(group.Locations) do
  289.                         if GetDistance(shroomSpot) < showLocationsInRange then
  290.                             if GetDistance(shroomSpot, mousePos) <= 250 then
  291.                                 shroomColour = 0xFFFFFF
  292.                             else
  293.                                 shroomColour = group.Colour
  294.                             end
  295.                             drawShroomCircles(shroomSpot.x, shroomSpot.y, shroomSpot.z,shroomColour)
  296.                         end
  297.                     end
  298.                 elseif showClose then
  299.                     for x, shroomSpot in pairs(group.Locations) do
  300.                         if GetDistance(shroomSpot) <= showCloseRange then
  301.                             if GetDistance(shroomSpot, mousePos) <= 250 then
  302.                                 shroomColour = 0xFFFFFF
  303.                             else
  304.                                 shroomColour = group.Colour
  305.                             end
  306.                             drawShroomCircles(shroomSpot.x, shroomSpot.y, shroomSpot.z,shroomColour)
  307.                         end
  308.                     end
  309.                 end
  310.             end
  311.         end
  312.     end
  313. end
  314.  
  315. -- Shrooms Main
  316. function InitializeShrooms()
  317.     red, yellow, green, blue, purple = 0x990000, 0x993300, 0x00FF00, 0x000099, 0x660066
  318.  
  319.     shroomSpots = {
  320.         -- High priority for both sides
  321.         HighPriority =  {
  322.                             Locations = {
  323.                                             { x = 3316.20,  y = -74.06, z = 9334.85},
  324.                                             { x = 4288.76,  y = -71.71, z = 9902.76},
  325.                                             { x = 3981.86,  y = 39.54,  z = 11603.55},
  326.                                             { x = 6435.51,  y = 47.51,  z = 9076.02},
  327.                                             { x = 9577.91,  y = 45.97,  z = 6634.53},
  328.                                             { x = 7635.25,  y = 45.09,  z = 5126.81},
  329.                                             { x = 10731.51, y = -30.77, z = 5287.01},
  330.                                             { x = 9662.24,  y = -70.79, z = 4536.15},
  331.                                             { x = 10080.45, y = 44.48,  z = 2829.56}  
  332.                                         },
  333.                             Colour = red,
  334.                             Enabled = highEnabled,
  335.                             Auto = AutoCarry.PluginMenu.AutoShroomsHigh,
  336.                             Snap = false
  337.                         },
  338.     -- Medium priority for both sides
  339.         MediumPriority ={
  340.                             Locations = {
  341.                                             { x = 3283.18,  y = -69.64, z = 10975.15},
  342.                                             { x = 2595.85,  y = -74.00, z = 11044.66},
  343.                                             { x = 2524.10,  y = 23.36,  z = 11912.28},
  344.                                             { x = 4347.64,  y = 43.34,  z = 7796.28},
  345.                                             { x = 6093.20,  y = -67.90, z = 8067.45},
  346.                                             { x = 7960.99,  y = -73.41, z = 6233.09},
  347.                                             { x = 10652.57, y = -58.96, z = 3507.64},
  348.                                             { x = 11460.14, y = -63.94, z = 3544.83},
  349.                                             { x = 11401.81, y = -11.72, z = 2626.61}  
  350.                                         },
  351.                             Colour = yellow,
  352.                             Enabled = medEnabled,
  353.                             Auto = AutoCarry.PluginMenu.AutoShroomsMedium,
  354.                             Snap = false
  355.                         },
  356.     -- Low priority/situational for both sides
  357.         LowPriority =   {
  358.                             Locations = {
  359.                                             { x = 1346.10,  y = 26.56,  z = 11064.81},
  360.                                             { x = 705.87,   y = 26.93,  z = 11359.88},
  361.                                             { x = 762.80,   y = 26.15,  z = 12210.61},
  362.                                             { x = 1355.53,  y = 24.13,  z = 12936.99},
  363.                                             { x = 1926.92,  y = 25.14,  z = 11567.44},
  364.                                             { x = 1752.22,  y = 24.02,  z = 13176.95},
  365.                                             { x = 2512.96,  y = 21.74,  z = 13524.44},
  366.                                             { x = 3577.42,  y = 25.27,  z = 12429.88},
  367.                                             { x = 5246.01,  y = 30.91,  z = 12508.33},
  368.                                             { x = 5549.60,  y = 42.94,  z = 10917.27},
  369.                                             { x = 6552.56,  y = 47.09,  z = 9688.99},
  370.                                             { x = 5806.41,  y = 46.01,  z = 9918.99},
  371.                                             { x = 7112.27,  y = 46.86,  z = 8443.55},
  372.                                             { x = 4896.10,  y = -72.08, z = 8964.81},
  373.                                             { x = 3096.10,  y = 45.41,  z = 8164.81},
  374.                                             { x = 2390.53,  y = 46.57,  z = 5232.34},
  375.                                             { x = 4358.81,  y = 45.83,  z = 5834.64},
  376.                                             { x = 5746.10,  y = 42.52,  z = 4864.81},
  377.                                             { x = 6307.66,  y = 46.07,  z = 7165.92},
  378.                                             { x = 5443.82,  y = 45.64,  z = 7110.85},
  379.                                             { x = 5153.75,  y = 45.41,  z = 3358.76},
  380.                                             { x = 6876.07,  y = 46.44,  z = 5897.48},
  381.                                             { x = 6881.30,  y = 46.08,  z = 6555.85},
  382.                                             { x = 8555.10,  y = 46.36,  z = 7267.04},
  383.                                             { x = 7946.10,  y = 44.19,  z = 7214.81},
  384.                                             { x = 9088.99,  y = -73.12, z = 5441.11},
  385.                                             { x = 7687.96,  y = 46.12,  z = 5203.08},
  386.                                             { x = 8559.97,  y = 47.97,  z = 3477.87},
  387.                                             { x = 8841.04,  y = 52.28,  z = 1944.09},
  388.                                             { x = 10582.93, y = 43.25,  z = 1707.35},
  389.                                             { x = 11046.10, y = 43.26,  z = 964.81},
  390.                                             { x = 11682.20, y = 43.40,  z = 1061.03},
  391.                                             { x = 12420.51, y = 46.87,  z = 1532.34},
  392.                                             { x = 12819.32, y = 45.74,  z = 1931.32},
  393.                                             { x = 13275.52, y = 45.38,  z = 2873.69},
  394.                                             { x = 11978.71, y = 45.49,  z = 2914.69},
  395.                                             { x = 13379.36, y = 45.37,  z = 3499.62},
  396.                                             { x = 12818.08, y = 45.38,  z = 3625.44},
  397.                                             { x = 10985.17, y = 45.69,  z = 6305.81},
  398.                                             { x = 11580.80, y = 41.26,  z = 9214.09},
  399.                                             { x = 9574.88,  y = 44.40,  z = 8679.65},
  400.                                             { x = 8359.96,  y = 44.37,  z = 9595.58},
  401.                                             { x = 8927.12,  y = 48.17,  z = 11175.70}  
  402.                                         },
  403.                             Colour = green,
  404.                             Enabled = lowEnabled,
  405.                             Auto = false,
  406.                             Snap = false
  407.                         },
  408.     -- blue team areas
  409.         BlueOnly = {
  410.                         Locations = {
  411.                                         { x = 2112.87, y = 43.81, z = 7047.48},
  412.                                         { x = 2646.25, y = 45.84, z = 7545.78},
  413.                                         { x = 1926.95, y = 44.83, z = 9515.71},
  414.                                         { x = 4239.97, y = 44.40, z = 7132.02},
  415.                                         { x = 6149.34, y = 42.51, z = 4481.88},
  416.                                         { x = 6630.28, y = 46.56, z = 2836.88},
  417.                                         { x = 7687.62, y = 45.54, z = 3210.98},
  418.                                         { x = 7050.22, y = 46.46, z = 2351.33}  
  419.                                     },
  420.                         Colour = blue,
  421.                         Enabled = blueEnabled,
  422.                         Auto = false,
  423.                         Snap = false
  424.                     },
  425.     -- purple team areas
  426.         PurpleOnly =    {
  427.                         Locations = {
  428.                                         { x = 7466.52, y = 41.54, z = 11720.22},
  429.                                         { x = 6945.85, y = 43.53, z = 11901.30},
  430.                                         { x = 6636.28, y = 45.03, z = 11079.65},
  431.                                         { x = 7878.53, y = 43.83, z = 10042.65},
  432.                                         { x = 9701.57, y = 45.72, z = 7298.22},
  433.                                         { x = 11358.86, y = 45.71, z = 6872.10},
  434.                                         { x = 11946.10, y = 45.80, z = 7414.81},
  435.                                         { x = 12169.52, y = 44.03, z = 4858.85}  
  436.                                     },
  437.                         Colour = purple,
  438.                         Enabled = purpEnabled,
  439.                         Auto = false,
  440.                         Snap = false
  441.                     }
  442.     }
  443. end
  444.  
  445. drawShroomSpots = false
  446.  
  447. function shroomExists(shroomSpot)
  448.     for i=1, objManager.maxObjects do
  449.     local obj = objManager:getObject(i)
  450.         if obj ~= nil and obj.name ~= nil and obj.name:find("Noxious Trap") then
  451.             if GetDistance(obj) <= 260 then
  452.                 return true
  453.             end
  454.         end
  455.     end
  456.     return false
  457. end
  458.  
  459. function PluginOnWndMsg(msg,key)
  460.     if msg == KEY_DOWN and key == string.byte("R") then
  461.         if player:CanUseSpell(SkillR.spellKey) == READY then
  462.             drawShroomSpots = true
  463.         end
  464.     elseif msg == WM_LBUTTONDOWN and drawShroomSpots and shroomSpots then
  465.         for i,group in pairs(shroomSpots) do
  466.             for x, shroomSpot in pairs(group.Locations) do
  467.                 if group.Snap or AutoCarry.PluginMenu.SnapShrooms then
  468.                     if GetDistance(shroomSpot, mousePos) <= 250 then
  469.                         CastSpell(SkillR.spellKey, shroomSpot.x, shroomSpot.z)
  470.                     end
  471.                 end
  472.             end
  473.         end
  474.     elseif msg == WM_RBUTTONDOWN and drawShroomSpots then
  475.         drawShroomSpots = false
  476.     end
  477. end
  478.  
  479. function drawShroomCircles(x,y,z,colour)
  480.     DrawCircle(x, y, z, 28, colour)
  481.     DrawCircle(x, y, z, 29, colour)
  482.     DrawCircle(x, y, z, 30, colour)
  483.     DrawCircle(x, y, z, 31, colour)
  484.     DrawCircle(x, y, z, 32, colour)
  485.     DrawCircle(x, y, z, 250, colour)
  486.     if colour == red or colour == blue
  487.         or colour == purple or colour == yellow then
  488.         DrawCircle(x, y, z, 251, colour)
  489.         DrawCircle(x, y, z, 252, colour)
  490.         DrawCircle(x, y, z, 253, colour)
  491.         DrawCircle(x, y, z, 254, colour)
  492.     end
  493. end
  494.  
  495. -- Shroom Hack
  496. function ShroomHackCount()
  497.     if nbStack then
  498.         if debugMode then PrintChat(""..nbStack.." Shrooms") end
  499.         if AutoCarry.PluginMenu.ShroomHack then
  500.             local plural = ""
  501.             if nbStack > 1 then
  502.                 plural = "s"
  503.             end
  504.             PrintFloatText(myHero, 20, ""..nbStack.." Shroom"..plural)
  505.         end
  506.     end
  507. end
  508.  
  509. function HexNetworkID(networkID,reverse)
  510.     if not VIP_USER then return false end
  511.     local po = CLoLPacket(0xDD)
  512.     po:EncodeF(networkID)
  513.     po.pos = 1
  514.     if reverse == true then
  515.         local s = string.format("%02X",po:Decode1())
  516.         s = s..string.format(" %02X",po:Decode1())
  517.         s = s..string.format(" %02X",po:Decode1())
  518.         s = s..string.format(" %02X",po:Decode1())
  519.         return s
  520.     else
  521.         local s = po:Decode4()
  522.         return string.format("%01X",s)
  523.     end
  524. end
  525.  
  526. local myHeroHexNetworkID = HexNetworkID(myHero.networkID, true)
  527.  
  528. function ShroomHackOnTick()
  529.     if not VIP_USER then return end
  530.     resyncPacket()  -- fake recv packet to avoid desync (update shroom stack and CD timer)
  531.     if NextShroomTime ~= nil and GetGameTimer() >= NextShroomTime - GetLatency()/1000 and nbStack == 2 and FreeShroom == true and recall == false then
  532.         FreeShroom = false
  533.  
  534.         -- Start of custom Teemo Shroom Hack code
  535.         if AutoCarry.PluginMenu.ShroomHack then
  536.             PrintFloatText(myHero, 10, "Shroom Hack!")
  537.             if not ShroomUnderEnemy() then
  538.                 CastSpell(_R, myHero.x, myHero.z)
  539.             end
  540.         end
  541.         -- End of custom Teemo Shroom Hack code
  542.  
  543.         NextShroomTime = nil
  544.     end
  545. end
  546.  
  547. function resyncPacket() -- fake recv packet to avoid desync (update shroom stack and CD timer)
  548.     if nbStack then
  549.         local pResync = CLoLPacket(0xFE)
  550.         pResync:EncodeF(myHero.networkID)
  551.         pResync:Encode2(0x0107)
  552.         pResync:Encode1(0x00)
  553.         pResync:Encode4(_R)
  554.         pResync:Encode4(nbStack) -- nb stack
  555.         pResync:Encode1(0xFF)
  556.         pResync:Encode1(0xFF)
  557.         pResync:Encode1(0xFF)
  558.         pResync:Encode1(0xFF)
  559.         if  NextShroomTime == nil or nbStack == 3 then
  560.             pResync:EncodeF(0)  --For Tecktonik mod try instead: pResync:EncodeF(math.random(0,CDTime))  
  561.         else
  562.             pResync:EncodeF(NextShroomTime-GetGameTimer())
  563.         end
  564.         pResync:EncodeF(CDTime)
  565.         RecvPacket(pResync)
  566.     end
  567. end
  568.  
  569. function OnRecvPacket(packet)
  570.     if not VIP_USER then return end
  571.     if packet.header == 0xFE and packet.size == 28 then -- Shroom stack(++)
  572.         packet.pos = 1
  573.         packet_networkID = packet:DecodeF() -- 4 Bytes myHero networkID
  574.         packet_type = packet:Decode2()  -- 2 bytes packet type
  575.         a1 = packet:Decode4()   -- 00 03 00 00
  576.         a2 = packet:Decode1()   -- 00
  577.         a3 = packet:Decode1()   -- nb shroom
  578.         a4 = packet:Decode1()   -- 00
  579.         a5 = packet:Decode1()   -- 00
  580.         a6 = packet:Decode1()   -- 00
  581.         a7 = packet:Decode4()   -- FF FF FF FF
  582.         a8 = packet:DecodeF()   -- 4 bytes shroom timer watch (actual countdown), range: from CDTime to 0 (decrease over time)   
  583.         a9 = packet:DecodeF()   -- 4 bytes shroom Total Cooldown Time (like CDTime) (used by Pie timer)
  584.         if packet_networkID == myHero.networkID and packet_type == 0x0107 and a1 == 0x00000300 and a2 == 0x00 and a4 == 0x00 and a5 == 0x00 and a6 == 0x00 and a7 == 0xFFFFFFFF then
  585.             CDTimeServer = a9
  586.             nbStack = a3
  587.             if debugMode then PrintChat("++nbStack: "..nbStack) end
  588.             ShroomHackCount()
  589.  
  590.             if myHero:GetSpellData(_R).level == 0 then
  591.                 CDTime = 35 -- when you take your ulti (1st time), it dont take cdr for 1st shroom cooldown
  592.             else
  593.                 BaseTime = (35 - (myHero:GetSpellData(_R).level - 1) * 4)
  594.                 CDTime = BaseTime * (1 + myHero.cdr)
  595.             end
  596.  
  597.             NextShroomTime = GetGameTimer() + CDTime - 0.2
  598.  
  599.             if nbStack == 2 then
  600.                 FreeShroom = true
  601.             end
  602.         end
  603.     elseif packet.header == 0xB5 then -- Shroom stack(--)
  604.         packet.pos = 0  -- reset pos for other script which use packet
  605.         stringPacket=dumpPacket(packet) -- i'm lazy so i will use string XD (big packets 105 and 122 bytes)
  606.         if string.find(stringPacket, myHeroHexNetworkID) == 5 and string.find(stringPacket, "00 00 80 3F "..myHeroHexNetworkID) and string.find(stringPacket, "00 00 00 80 3E 00 00 00 00 00 00 80 3F") and string.find(stringPacket, "3F 00 00 00 00 00 03 00 00") then -- shroom on object (packet size vary often 122,139,156,173 depend object and how many object)
  607.             if nbStack then
  608.                 nbStack = nbStack - 1
  609.                 --PrintChat("--nbStack: "..nbStack)
  610.                 ShroomHackCount()
  611.                 if nbStack == 2 then
  612.                     BaseTime = (35 - (myHero:GetSpellData(_R).level - 1) * 4)
  613.                     CDTime = BaseTime * (1 + myHero.cdr)
  614.                     NextShroomTime = GetGameTimer() + CDTime
  615.  
  616.                     FreeShroom = true
  617.                 end
  618.             end
  619.         end
  620.     end
  621.  
  622.     packet.pos = 0 -- reset pos for other script which use packet
  623. end
  624.  
  625. function dumpPacket(p)
  626.     local sPacket = ""
  627.     for i=1,p.size,1 do
  628.         sPacket = sPacket .. string.format(" %02X",p:Decode1())
  629.     end
  630.     return sPacket
  631. end
  632.  
  633. function OnRecall(hero, channelTimeInMs)    -- gets triggered when somebody starts to recall
  634.     if hero.isMe then
  635.         recall = true
  636.     end
  637. end
  638.  
  639. function OnAbortRecall(hero)                -- gets triggered when somebody aborts a recall
  640.     if hero.isMe then
  641.         recall = false
  642.     end
  643. end
  644.  
  645. function OnFinishRecall(hero)
  646.     if hero.isMe then
  647.         recall = false
  648.     end
  649. end
  650.  
  651. function ShroomHackOnProcessSpell(unit, spell)
  652.     if not VIP_USER then return end
  653.     if unit.isMe and spell.name == "BantamTrap" then
  654. --[[
  655.         if freeShroom then
  656.             freeShroom = false
  657.         else
  658.             if traps == 3 then
  659.                 nextShroom = GetGameTimer() + ShroomCooldown()
  660.             end
  661.  
  662.  
  663.  
  664.  
  665.             traps = traps - 1
  666. --]]
  667.             ShroomHackCount()
  668. --[[
  669.         end
  670. --]]
  671.     end
  672. end
  673.  
  674. function round(num, idp)
  675.     local mult = 10^(idp or 0)
  676.     return math.floor(num * mult + 0.5) / mult
  677. end
Advertisement
Add Comment
Please, Sign In to add comment