Kain2030

Auto Carry Plugin - Teemo Edition - v1.1k

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