manciuszz

Vaynes Mighty Assistant (2013.11.05)

May 4th, 2013
33,878
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.46 KB | None | 0 0
  1. --[[
  2.                  _.--""--._
  3.                 /  _    _  \
  4.              _  ( (_\  /_) )  _
  5.             { \._\   /\   /_./ }
  6.             /_"=-.}______{.-="_\
  7.              _  _.=("""")=._  _
  8.             (_'"_.-"`~~`"-._"'_)
  9.              {_"            "_}
  10.  
  11.          Vayne's Mighty Assistant
  12.                     by Manciuszz.
  13.  
  14.          » Auto-Condemn = Automatically condemns enemy into walls, structures(inhibitors, towers, nexus).
  15.             • Prediction[VIP ONLY]/No Prediction mode
  16.             • Takes into account enemy hitboxes.
  17.             • Doesn't interrupt recalling.
  18.  
  19.          » Auto-Condemn on incoming gapclosers!
  20.  
  21.          » Manual Condemn-Assistant = Draws a circle of predicted position after condemn.
  22.             • Draw Arrow/Simple circle
  23.  
  24.          » Disable Auto-Condemn on certain champions in-game.
  25. ]]
  26.  
  27. if myHero.charName ~= "Vayne" then return end
  28. local VayneAssistant
  29.  
  30. local enemyTable = GetEnemyHeroes()
  31.  
  32. local informationTable = {}
  33. local spellExpired = true
  34.  
  35. local tp = TargetPredictionVIP(1000, 2200, 0.25)
  36. local AllClassMenu = 16
  37.  
  38. -- Code -------------------------------------------
  39.  
  40. function OnLoad()
  41.     VayneAssistant = scriptConfig("Vayne's Mighty Assistant", "VayneAssistant")
  42.  
  43.     VayneAssistant:addSubMenu("Features & Settings", "settingsSubMenu")
  44.     VayneAssistant:addSubMenu("Disable Auto-Condemn on", "condemnSubMenu")
  45.  
  46.     VayneAssistant:addParam("autoCondemn", "Auto-Condemn Toggle:", SCRIPT_PARAM_ONKEYTOGGLE, true, GetKey("N"))
  47.     VayneAssistant:addParam("switchKey", "Switch key mode:", SCRIPT_PARAM_ONOFF, false)
  48.  
  49.     VayneAssistant.settingsSubMenu:addParam("PushAwayGapclosers", "Push Gapclosers Away", SCRIPT_PARAM_ONOFF, true)
  50.     VayneAssistant.settingsSubMenu:addParam("CondemnAssistant", "Condemn Visual Assistant:", SCRIPT_PARAM_ONOFF, true)
  51.     VayneAssistant.settingsSubMenu:addParam("pushDistance", "Push Distance", SCRIPT_PARAM_SLICE, 300, 0, 450, 0) -- Reducing this value means that the enemy has to be closer to the wall, so you could cast condemn.
  52.     VayneAssistant.settingsSubMenu:addParam("eyeCandy", "After-Condemn Circle:", SCRIPT_PARAM_ONOFF, true)
  53.     if not VIP_USER then
  54.         VayneAssistant.settingsSubMenu:addParam("shootingMode", "Currently: No prediction", SCRIPT_PARAM_INFO, "NOT VIP")
  55.     else
  56.         VayneAssistant.settingsSubMenu:addParam("shootingMode", "Prediction/No prediction:", SCRIPT_PARAM_ONOFF, true)
  57.     end
  58.  
  59.     VayneAssistant:permaShow("autoCondemn")
  60.     -- Override in case it's stuck.
  61. --    VayneAssistant.pushDistance = 300
  62.     VayneAssistant.autoCondemn = true
  63.     VayneAssistant.switchKey = false
  64.  
  65.     for i, enemy in ipairs(enemyTable) do
  66.         VayneAssistant.condemnSubMenu:addParam("disableCondemn"..i, " >> "..enemy.charName, SCRIPT_PARAM_ONOFF, false)
  67.         VayneAssistant["disableCondemn"..i] = false -- Override
  68.     end
  69.     PrintChat(" >> Vayne's Mighty Assistant!")
  70. end
  71.  
  72. function OnDraw()
  73.     if myHero.dead then return end
  74.  
  75.     if IsKeyDown(AllClassMenu) then
  76.         VayneAssistant._param[1].pType = VayneAssistant.switchKey and 2 or 3
  77.         VayneAssistant._param[1].text  = VayneAssistant.switchKey and "Auto-Condemn OnHold:" or "Auto-Condemn Toggle:"
  78.         if VayneAssistant.switchKey and VayneAssistant.autoCondemn then
  79.             VayneAssistant.autoCondemn = false
  80.         end
  81.  
  82.         VayneAssistant.settingsSubMenu._param[5].text  = VayneAssistant.settingsSubMenu.shootingMode and VIP_USER and "Currently: Using Predictions" or "Currently: No prediction"
  83.         if not VIP_USER then VayneAssistant.settingsSubMenu.shootingMode = "NOT VIP" end
  84.     end
  85.  
  86.     if myHero:CanUseSpell(_E) == READY then
  87.         if VayneAssistant.settingsSubMenu.PushAwayGapclosers then
  88.             if not spellExpired and (GetTickCount() - informationTable.spellCastedTick) <= (informationTable.spellRange/informationTable.spellSpeed)*1000 then
  89.                 local spellDirection     = (informationTable.spellEndPos - informationTable.spellStartPos):normalized()
  90.                 local spellStartPosition = informationTable.spellStartPos + spellDirection
  91.                 local spellEndPosition   = informationTable.spellStartPos + spellDirection * informationTable.spellRange
  92.                 local heroPosition = Point(myHero.x, myHero.z)
  93.  
  94.                 local lineSegment = LineSegment(Point(spellStartPosition.x, spellStartPosition.y), Point(spellEndPosition.x, spellEndPosition.y))
  95.                 --lineSegment:draw(ARGB(255, 0, 255, 0), 70)
  96.  
  97.                 if lineSegment:distance(heroPosition) <= (not informationTable.spellIsAnExpetion and 65 or 200) then
  98.                     CastSpell(_E, informationTable.spellSource)
  99.                 end
  100.             else
  101.                 spellExpired = true
  102.                 informationTable = {}
  103.             end
  104.         end
  105.  
  106.         if VayneAssistant.autoCondemn then
  107.             for i, enemyHero in ipairs(enemyTable) do
  108.                 if not VayneAssistant.condemnSubMenu["disableCondemn"..i] then
  109.                     if enemyHero ~= nil and enemyHero.valid and not enemyHero.dead and enemyHero.visible and GetDistance(enemyHero) <= 715 and GetDistance(enemyHero) > 0 then
  110.                         local enemyPosition = VayneAssistant.settingsSubMenu.shootingMode and VIP_USER and tp:GetPrediction(enemyHero) or enemyHero
  111.                         local PushPos = enemyPosition + (Vector(enemyPosition) - myHero):normalized()*VayneAssistant.settingsSubMenu.pushDistance
  112.  
  113.                         if enemyHero.x > 0 and enemyHero.z > 0 then
  114.                             local checks = math.ceil((VayneAssistant.settingsSubMenu.pushDistance)/65)
  115.                             local checkDistance = (VayneAssistant.settingsSubMenu.pushDistance)/checks
  116.                             local InsideTheWall = false
  117.                             for k=1, checks, 1 do
  118.                                 local checksPos = enemyPosition + (Vector(enemyPosition) - myHero):normalized()*(checkDistance*k)
  119.                                 local WallContainsPosition = IsWall(D3DXVECTOR3(checksPos.x, checksPos.y, checksPos.z))
  120.                                 if WallContainsPosition then
  121.                                     InsideTheWall = true
  122.                                     break
  123.                                 end
  124.                             end
  125.  
  126.                             if InsideTheWall then CastSpell(_E, enemyHero) end
  127.  
  128.                             if VayneAssistant.settingsSubMenu.eyeCandy and PushPos.x > 0 and PushPos.z > 0 then
  129.                                 DrawCircle(PushPos.x, PushPos.y, PushPos.z, 65, ARGB(255, 0, 255, 0))
  130.                             end
  131.  
  132.  
  133.                         end
  134.                     end
  135.                 end
  136.             end
  137.         end
  138.     end
  139. end
  140.  
  141. function OnProcessSpell(unit, spell)
  142.     if not VayneAssistant.settingsSubMenu.PushAwayGapclosers then return end
  143.  
  144.     local jarvanAddition = unit.charName == "JarvanIV" and unit:CanUseSpell(_Q) ~= READY and _R or _Q -- Did not want to break the table below.
  145.     local isAGapcloserUnit = {
  146. --        ['Ahri']        = {true, spell = _R, range = 450,   projSpeed = 2200},
  147.         ['Aatrox']      = {true, spell = _Q,                  range = 1000,  projSpeed = 1200, },
  148.         ['Akali']       = {true, spell = _R,                  range = 800,   projSpeed = 2200, }, -- Targeted ability
  149.         ['Alistar']     = {true, spell = _W,                  range = 650,   projSpeed = 2000, }, -- Targeted ability
  150.         ['Diana']       = {true, spell = _R,                  range = 825,   projSpeed = 2000, }, -- Targeted ability
  151.         ['Gragas']      = {true, spell = _E,                  range = 600,   projSpeed = 2000, },
  152.         ['Graves']      = {true, spell = _E,                  range = 425,   projSpeed = 2000, exeption = true },
  153.         ['Hecarim']     = {true, spell = _R,                  range = 1000,  projSpeed = 1200, },
  154.         ['Irelia']      = {true, spell = _Q,                  range = 650,   projSpeed = 2200, }, -- Targeted ability
  155.         ['JarvanIV']    = {true, spell = jarvanAddition,      range = 770,   projSpeed = 2000, }, -- Skillshot/Targeted ability
  156.         ['Jax']         = {true, spell = _Q,                  range = 700,   projSpeed = 2000, }, -- Targeted ability
  157.         ['Jayce']       = {true, spell = 'JayceToTheSkies',   range = 600,   projSpeed = 2000, }, -- Targeted ability
  158.         ['Khazix']      = {true, spell = _E,                  range = 900,   projSpeed = 2000, },
  159.         ['Leblanc']     = {true, spell = _W,                  range = 600,   projSpeed = 2000, },
  160.         ['LeeSin']      = {true, spell = 'blindmonkqtwo',     range = 1300,  projSpeed = 1800, },
  161.         ['Leona']       = {true, spell = _E,                  range = 900,   projSpeed = 2000, },
  162.         ['Malphite']    = {true, spell = _R,                  range = 1000,  projSpeed = 1500 + unit.ms},
  163.         ['Maokai']      = {true, spell = _Q,                  range = 600,   projSpeed = 1200, }, -- Targeted ability
  164.         ['MonkeyKing']  = {true, spell = _E,                  range = 650,   projSpeed = 2200, }, -- Targeted ability
  165.         ['Pantheon']    = {true, spell = _W,                  range = 600,   projSpeed = 2000, }, -- Targeted ability
  166.         ['Poppy']       = {true, spell = _E,                  range = 525,   projSpeed = 2000, }, -- Targeted ability
  167.         --['Quinn']       = {true, spell = _E,                  range = 725,   projSpeed = 2000, }, -- Targeted ability
  168.         ['Renekton']    = {true, spell = _E,                  range = 450,   projSpeed = 2000, },
  169.         ['Sejuani']     = {true, spell = _Q,                  range = 650,   projSpeed = 2000, },
  170.         ['Shen']        = {true, spell = _E,                  range = 575,   projSpeed = 2000, },
  171.         ['Tristana']    = {true, spell = _W,                  range = 900,   projSpeed = 2000, },
  172.         ['Tryndamere']  = {true, spell = 'Slash',             range = 650,   projSpeed = 1450, },
  173.         ['XinZhao']     = {true, spell = _E,                  range = 650,   projSpeed = 2000, }, -- Targeted ability
  174.     }
  175.     if unit.type == 'obj_AI_Hero' and unit.team == TEAM_ENEMY and isAGapcloserUnit[unit.charName] and GetDistance(unit) < 2000 and spell ~= nil then
  176.         if spell.name == (type(isAGapcloserUnit[unit.charName].spell) == 'number' and unit:GetSpellData(isAGapcloserUnit[unit.charName].spell).name or isAGapcloserUnit[unit.charName].spell) then
  177.             if spell.target ~= nil and spell.target.name == myHero.name or isAGapcloserUnit[unit.charName].spell == 'blindmonkqtwo' then
  178. --                print('Gapcloser: ',unit.charName, ' Target: ', (spell.target ~= nil and spell.target.name or 'NONE'), " ", spell.name, " ", spell.projectileID)
  179.                 CastSpell(_E, unit)
  180.             else
  181.                 spellExpired = false
  182.                 informationTable = {
  183.                     spellSource = unit,
  184.                     spellCastedTick = GetTickCount(),
  185.                     spellStartPos = Point(spell.startPos.x, spell.startPos.z),
  186.                     spellEndPos = Point(spell.endPos.x, spell.endPos.z),
  187.                     spellRange = isAGapcloserUnit[unit.charName].range,
  188.                     spellSpeed = isAGapcloserUnit[unit.charName].projSpeed,
  189.                     spellIsAnExpetion = isAGapcloserUnit[unit.charName].exeption or false,
  190.                 }
  191.             end
  192.         end
  193.     end
  194.  
  195. end
Advertisement
Add Comment
Please, Sign In to add comment