Advertisement
Kain2030

Auto Carry Plugin - Teemo Edition - v1.1m

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