Kain2030

Auto Carry Plugin - Lucian Edition - v1.07c

Aug 22nd, 2013
1,949
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.84 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Lucian Edition
  4.         Author: Kain
  5.         Version: 1.07c
  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 - Lucian.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14.        
  15.         Version History:
  16.             Version: 1.07c: http://pastebin.com/tK2WNXsy
  17.                 Relentless Pursuit Out of Enemy slows.
  18.                 Tweaked prediction variables.
  19.                 Killsteal enabled.
  20.             Version: 1.06c: http://pastebin.com/sdvmmNyR
  21.                 Spell weaving.
  22.                 Draw range logic improvement.
  23.                 Menu updates.
  24.             Version: 1.05d Beta: http://pastebin.com/rE5X8puE
  25.                 Improvements to mechanics of Culling Lockon. (Still more to do here.)
  26.                 Fix issue with Ultimate ending early.
  27.                 Miscellaneous bug fixes.
  28.             Version: 1.04 Beta Pre-Release: http://pastebin.com/ayEX5Bfq
  29.                 Culling Lockon added. Considered experimental, but seems to be working pretty well.
  30.             Version: 1.02 Beta Pre-Release: http://pastebin.com/tXxr95g9
  31.             Version: 1.0 Alpha: http://pastebin.com/xWbRz89K
  32. --]]
  33.  
  34. if myHero.charName ~= "Lucian" then return end
  35.  
  36. function PluginOnLoad()
  37.     Vars()
  38.     Menu()
  39.  
  40.     AutoCarry.SkillsCrosshair.range = QMaxRange
  41. end
  42.  
  43. function Vars()
  44.     tick = nil
  45.     Target = nil
  46.  
  47.     -- Confirm ranges on release.
  48.     QRange = 550
  49.     QMaxRange = 1100
  50.     WRange = 1000
  51.     ERange = 425
  52.     RRange = 1400
  53.  
  54.     QSpeed = 19.346
  55.     WSpeed = 1.47 -- Old: 1.009
  56.     ESpeed = 3.867
  57.     RSpeed = 2.9 -- Old: 1.3
  58.  
  59.     QWidth = 250
  60.     WWidth = 250
  61.     EWidth = 250
  62.     RWidth = 250
  63.  
  64.     QDelay = 405
  65.     WDelay = 288 -- Old: 256
  66.     EDelay = 1070
  67.     RDelay = 200
  68.  
  69.     RRefresh = 0.1
  70.     RDuration = 3.2 -- Old: 3.0 2.871 - 3.167
  71.  
  72.     ParticleRProjectileName = "Lucian_R_mis.troy"
  73.     ParticleRProjectileNameOld = "bowMaster_volley_mis.troy"
  74.     ParticleR = "Lucian_R_tar.troy"
  75.     ParticleRFiring = "Lucian_R_self.troy"
  76.  
  77.     -- Start New
  78.     BuffPassive = "lucianpassivebuff" -- Old: "Lightslinger"
  79.     BuffW = "lucianwcastingbuff"
  80.     BuffR = "LucianR"
  81.  
  82.     -- End New
  83. --[[
  84.     Raw data dump:
  85.  
  86.     spellName = LucianBasicAttack
  87.     projectileName = ???
  88.     castDelay = 4001.50 (827.00-7176.00)
  89.     projectileSpeed = 6321.08 (724.19-11917.96)
  90.     range = 2594.85 (541.70-4648.01)
  91.  
  92.     spellName = LucianW
  93.     projectileName = Lucian_W_mis.troy
  94.     castDelay = 288.67 (265.00-297.00)
  95.     projectileSpeed = 1484.95 (1391.22-1640.62)
  96.     range = 661.85 (304.68-1000.83)
  97.  
  98.     spellName = LucianE
  99.     projectileName = Lucian_W_mis.troy
  100.     castDelay = 8189.75 (0.00-32245.00)
  101.     projectileSpeed = 25590.51 (703.58-79656.61)
  102.     range = 3772.70 (372.90-8054.26)
  103.  
  104.     spellName = LucianR
  105.     projectileName = Lucian_R_mis.troy
  106.     castDelay = 210.50 (187.00-234.00)
  107.     projectileSpeed = 2850.25 (2342.64-3357.86)
  108.     range = 405.05 (261.91-548.18)
  109.  
  110.     Raw data dump #2:
  111.  
  112.     spellName = LucianW
  113.     projectileName = Lucian_W_mis.troy
  114.     castDelay = 313.81 (265.00-453.00)
  115.     projectileSpeed = 1459.60 (558.14-1797.76)
  116.     range = 648.24 (17.30-1007.14)
  117.  
  118.     spellName = LucianE
  119.     projectileName = Lucian_W_mis.troy
  120.     castDelay = 2147.83 (0.00-10530.00)
  121.     projectileSpeed = 4680.15 (632.65-14746.30)
  122.     range = 3349.24 (809.79-8272.67)
  123.  
  124.     spellName = LucianR
  125.     projectileName = Lucian_R_mis.troy
  126.     castDelay = 199.80 (172.00-218.00)
  127.     projectileSpeed = 3023.31 (2816.79-3321.66)
  128.     range = 757.80 (205.94-1063.38)
  129.  
  130. --]]
  131.  
  132.     SkillQ = {spellKey = _Q, range = QRange, speed = QSpeed, delay = QDelay, width = QWidth, configName = "piercinglight", displayName = "Q (Piercing Light)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  133.     SkillW = {spellKey = _W, range = WRange, speed = WSpeed, delay = WDelay, width = WWidth, configName = "ardentblaze", displayName = "W (Ardent Blaze)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  134.     SkillE = {spellKey = _E, range = ERange, speed = ESpeed, delay = EDelay, width = EWidth, configName = "relentlesspursuit", displayName = "E (Relentless Pursuit)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  135.     SkillR = {spellKey = _R, range = RRange, speed = RSpeed, delay = RDelay, width = RWidth, configName = "theculling", displayName = "R (The Culling)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  136.  
  137.     KeyQ = string.byte("Q")
  138.     KeyW = string.byte("W")
  139.     KeyE = string.byte("E")
  140.     KeyR = string.byte("R")
  141.  
  142.     KeyTest = string.byte("U")
  143.  
  144.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
  145.     QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, IReady = false, false, false, false, false, false, false, false
  146.  
  147.     ultCastTick = 0
  148.     ultCastTarget = nil
  149.     ultVectorX = nil
  150.     ultVectorZ = nil
  151.  
  152.     isSlowed = false
  153.  
  154.     healthLastTick = 0
  155.     healthLastHealth = 0
  156.  
  157.     isUltFiring = false
  158.     lastUltMessage = 0
  159.  
  160.     comboActive = false
  161.     nextAttack = 0
  162.  
  163.     debugMode = false
  164.     debugModeDisableNonR = false
  165. end
  166.  
  167. function Menu()
  168.     AutoCarry.PluginMenu:addParam("sep", "----- [ Combo ] -----", SCRIPT_PARAM_INFO, "")
  169.     AutoCarry.PluginMenu:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  170.     AutoCarry.PluginMenu:addParam("FullCombo", "Insta Blast Combo (No AA)", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
  171.     AutoCarry.PluginMenu:addParam("ComboQ", "Use Piercing Light", SCRIPT_PARAM_ONOFF, true)
  172.     AutoCarry.PluginMenu:addParam("ComboW", "Use Ardent Blaze", SCRIPT_PARAM_ONOFF, true)
  173.     AutoCarry.PluginMenu:addParam("ComboE", "Use Relentless Pursuit", SCRIPT_PARAM_ONOFF, true)
  174.     AutoCarry.PluginMenu:addParam("ComboR", "Use The Culling", SCRIPT_PARAM_ONOFF, true)
  175.     AutoCarry.PluginMenu:addParam("SmartE", "Smart Relentless Pursuit", SCRIPT_PARAM_ONOFF, true)
  176.     AutoCarry.PluginMenu:addParam("UltLockOn", "Use Ultimate Lock On (Beta)", SCRIPT_PARAM_ONOFF, true)
  177.     AutoCarry.PluginMenu:addParam("sep", "----- [ Misc ] -----", SCRIPT_PARAM_INFO, "")
  178.     AutoCarry.PluginMenu:addParam("PursuitSlow", "Pursuit Out of Slows", SCRIPT_PARAM_ONOFF, true)
  179.     AutoCarry.PluginMenu:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  180.     AutoCarry.PluginMenu:addParam("AutoHarass", "Auto Harass", SCRIPT_PARAM_ONOFF, false)
  181.     AutoCarry.PluginMenu:addParam("sep", "----- [ Killsteal ] -----", SCRIPT_PARAM_INFO, "")
  182.     AutoCarry.PluginMenu:addParam("Killsteal", "Killsteal (Disabled until BoL update)", SCRIPT_PARAM_ONOFF, true)
  183.     AutoCarry.PluginMenu:addParam("KillstealUlt", "Killsteal with Ult", SCRIPT_PARAM_ONOFF, false)
  184.     AutoCarry.PluginMenu:addParam("sep", "----- [ Advanced ] -----", SCRIPT_PARAM_INFO, "")
  185.     AutoCarry.PluginMenu:addParam("EMinMouseDiff", "Pursuit Min. Mouse Diff.", SCRIPT_PARAM_SLICE, 600, 100, 1000, 0)
  186.     AutoCarry.PluginMenu:addParam("ProMode", "Use Auto QWER Keys", SCRIPT_PARAM_ONOFF, true)
  187. --[[
  188.     AutoCarry.PluginMenu:addParam("HealthPercentage", "Health Drop %",SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
  189.     AutoCarry.PluginMenu:addParam("HealthTime", "Health Tracking Time",SCRIPT_PARAM_SLICE, 0, 2, 5, 0)
  190. --]]
  191.     AutoCarry.PluginMenu:addParam("sep", "----- [ Draw ] -----", SCRIPT_PARAM_INFO, "")
  192.     AutoCarry.PluginMenu:addParam("DisableDraw", "Disable Draw", SCRIPT_PARAM_ONOFF, false)
  193.     AutoCarry.PluginMenu:addParam("DrawFurthest", "Draw Furthest Spell Available", SCRIPT_PARAM_ONOFF, true)
  194.     AutoCarry.PluginMenu:addParam("DrawQ", "Draw Piercing Light", SCRIPT_PARAM_ONOFF, true)
  195.     AutoCarry.PluginMenu:addParam("DrawW", "Draw Ardent Blaze", SCRIPT_PARAM_ONOFF, true)
  196.     AutoCarry.PluginMenu:addParam("DrawE", "Draw Relentless Pursuit", SCRIPT_PARAM_ONOFF, true)
  197.     AutoCarry.PluginMenu:addParam("DrawR", "Draw The Culling", SCRIPT_PARAM_ONOFF, true)
  198. end
  199.  
  200. function PluginOnTick()
  201.     tick = GetTickCount()
  202.     Target = AutoCarry.GetAttackTarget(true)
  203.  
  204.     SpellCheck()
  205.  
  206.     -- GetTickCount() % 5 == 0) and
  207.     if math.fmod(GetTickCount(), 25) and IsFiringUlt() then
  208.         CheckRPosition()
  209.     else
  210.         if (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode or AutoCarry.PluginMenu.Combo) then
  211.             comboActive = true
  212.             Combo()
  213.         else
  214.             comboActive = false
  215.         end
  216.  
  217.         if AutoCarry.PluginMenu.FullCombo then
  218.             FullCombo()
  219.         end
  220.  
  221.         if AutoCarry.PluginMenu.Harass then
  222.             Harass()
  223.         end
  224.  
  225.         if AutoCarry.PluginMenu.Killsteal then
  226.             KillSteal()
  227.         end
  228.     end
  229. end
  230.  
  231. function PluginOnCreateObj(obj)
  232.     -- Nothing to do here.
  233.     if obj.name == ParticleRFiring then
  234.         if debugMode then PrintChat("Ult Particle Started") end
  235.         isUltFiring = true
  236.         if debugMode then PrintChat("start: "..(GetTickCount() / 1000)) end
  237.     end
  238. end
  239.  
  240. function PluginOnDeleteObj(obj)
  241.     if obj.name == ParticleRFiring then
  242.         if debugMode then PrintChat("Ult Particle Stopped") end
  243.         isUltFiring = false
  244.         UltFireStop()
  245.         if debugMode then PrintChat("stop: "..(GetTickCount() / 1000)) end
  246.     end
  247. end
  248.  
  249. function OnAttacked()
  250.     -- AA > Q > AA
  251.     if AutoCarry.PluginMenu.AutoHarass then CastQ() end
  252.  
  253.     if comboActive and GetTickCount() > nextAttack then
  254.         nextAttack = AutoCarry.GetNextAttackTime()
  255.  
  256.         if AutoCarry.PluginMenu.ComboW then CastW() end
  257.         if AutoCarry.PluginMenu.ComboE then CastE() end
  258.         if AutoCarry.PluginMenu.ComboQ then CastQ() end
  259.     end
  260. end
  261.  
  262. --[[
  263. function CustomAttackEnemy(enemy)
  264.         if enemy.dead or not enemy.valid then return end
  265.         -- myHero:Attack(enemy)
  266.         -- AutoCarry.shotFired = true
  267. end
  268. --]]
  269.  
  270. function OnGainBuff(unit, buff)
  271.     if unit.name == myHero.name and unit.team == myHero.team and (buff.type == 5 or buff.type == 10 or buff.type == 11) then
  272.         -- BUFF_STUN = 5 BUFF_SLOW = 10 BUFF_ROOT = 11
  273.         if AutoCarry.PluginMenu.PursuitSlow then
  274.             isSlowed = true
  275.             CastE()
  276.         end
  277.     end
  278. end
  279.  
  280. function SpellCheck()
  281.     DFGSlot, HXGSlot, BWCSlot, BRKSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  282.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3153), GetInventorySlotItem(3057),
  283.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  284.  
  285.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  286.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  287.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  288.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  289.  
  290.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  291.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  292.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  293.     BRKReady = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  294.  
  295.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  296. end
  297.  
  298. -- Handle SBTW Skill Shots
  299.  
  300. function Combo()
  301.     if not debugModeDisableNonR then
  302.         CastSlots()
  303.     end
  304.  
  305.     if AutoCarry.PluginMenu.ComboR then CastR() end
  306. end
  307.  
  308. function FullCombo()
  309.     CastSlots()
  310.     CastW()
  311.     CastE()
  312.     CastQ()
  313.     CastR()
  314. end
  315.  
  316. function CastSlots()
  317.     if Target ~= nil then
  318.         if GetDistance(Target) <= QRange then
  319.             if DFGReady then CastSpell(DFGSlot, Target) end
  320.             if HXGReady then CastSpell(HXGSlot, Target) end
  321.             if BWCReady then CastSpell(BWCSlot, Target) end
  322.             if BRKReady then CastSpell(BRKSlot, Target) end
  323.         end
  324.     end
  325. end
  326.  
  327. function Harass()
  328.     CastQ()
  329. end
  330.  
  331. function CastQ(enemy)
  332.     -- Q (Piercing Light)
  333.     if not enemy then enemy = Target end
  334.  
  335.     if enemy ~= nil and QReady and ValidTarget(enemy, QRange) then
  336.         if debugMode then PrintChat("Cast Q") end
  337.         CastSpell(SkillQ.spellKey, enemy)
  338.         return true
  339.     end
  340. end
  341.  
  342. function CastW(enemy)
  343.     -- W (Ardent Blaze)
  344.     if not enemy then enemy = Target end
  345.  
  346.     if enemy ~= nil and WReady and ValidTarget(enemy, WRange) then
  347.         if debugMode then PrintChat("Cast W") end
  348.         AutoCarry.CastSkillshot(SkillW, enemy)
  349.         return true
  350.     end
  351. end
  352.  
  353. --[[
  354. function CastEOld()
  355.     -- E (Relentless Pursuit)
  356.     if debugMode then
  357.         -- PrintChat("Mouse Distance: "..GetDistance(mousePos))
  358.     end
  359.  
  360.     if EReady then
  361.         -- if ( math.abs(mousePos.x - myHero.x) > PursuitMinMouseDiff or math.abs(mousePos.z - myHero.z) > PursuitMinMouseDiff) then
  362.         if ((GetDistance(mousePos) > PursuitMinMouseDiff) and isEnemyInRange(SkillE.range + SkillR.range)) then
  363.             if debugMode then PrintChat("Cast E") end
  364.             CastSpell(SkillE.spellKey, mousePos.x, mousePos.z)
  365.         end
  366.     end
  367. end
  368. --]]
  369.  
  370. function CastE()
  371.     if AutoCarry.PluginMenu.SmartE then
  372.         if ((GetDistance(mousePos) > AutoCarry.PluginMenu.EMinMouseDiff or isSlowed) and isEnemyInRange(SkillE.range + SkillR.range)) then
  373.             local dashSqr = math.sqrt((mousePos.x - myHero.x)^2+(mousePos.z - myHero.z)^2)
  374.             local dashX = myHero.x + ERange*((mousePos.x - myHero.x)/dashSqr)
  375.             local dashZ = myHero.z + ERange*((mousePos.z - myHero.z)/dashSqr)
  376.             CastSpell(SkillE.spellKey, dashX, dashZ)
  377.             isSlowed = false
  378.             return true
  379.         end
  380.     else
  381.         CastSpell(SkillE.spellKey, mousePos.x, mousePos.z)
  382.         isSlowed = false
  383.         return true
  384.     end
  385. end
  386.  
  387. function CastR(enemy)
  388.     if not enemy then enemy = Target end
  389.     -- R (The Culling)
  390.     if enemy ~= nil and RReady and ValidTarget(enemy, RRange) then
  391.         if not IsFiringUlt() then
  392.             if debugMode then PrintChat("Cast R") end
  393.             if not isUltFiring then
  394.                 AutoCarry.CastSkillshot(SkillR, enemy)
  395.                 if AutoCarry.PluginMenu.UltLockOn and GetTickCount() > (lastUltMessage + 2000) then
  396.                     lastUltMessage = GetTickCount()
  397.                     PrintFloatText(myHero, 10, "Ultimate Locked On!")
  398.                 end
  399.             end
  400.  
  401.             ultCastTarget = enemy
  402.             ultCastTick = GetTickCount()
  403.  
  404.             -- Vector from target -> myHero
  405.             if ultVectorX == nil and ultVectorZ == nil then
  406.                 if debugMode and false then PrintChat("update x,z") end
  407.                 ultVectorX,y,ultVectorZ = (Vector(myHero) - Vector(ultCastTarget)):normalized():unpack()
  408.             end
  409.         end
  410.  
  411.         CheckRPosition()
  412.     end
  413. end
  414.  
  415. function CheckRPosition()
  416.     if (ultCastTick > 0) then
  417.         if debugMode and IsFiringUlt() then burp = "true" else burp = "false" end
  418.         if debugMode and false then PrintChat("Tick: "..GetTickCount()..", ultCastTick: "..ultCastTick..", RDuration: "..(ultCastTick + (RDuration * 1000))..", IsFiringUlt: "..burp) end
  419.     end
  420.  
  421.     if AutoCarry.PluginMenu.UltLockOn and IsFiringUlt() then
  422.         MoveMyHeroToRPosition()
  423.     end
  424. end
  425.  
  426. function MoveMyHeroToRPosition()
  427.     -- Please don't steal this function!
  428.     local tpR = VIP_USER and TargetPredictionVIP(RRange, RSpeed*1000, RRefresh, RWidth) or TargetPrediction(RRange, RSpeed, RRefresh*1000, RWidth)
  429.  
  430.     local target = nil
  431.     if ultCastTarget ~= nil then
  432.         target = ultCastTarget
  433.     else
  434.         target = Target
  435.     end
  436.  
  437.     local predR = tpR:GetPrediction(target)
  438.  
  439.     if not predR then return end
  440.  
  441.     local RRangeBuffered = RRange * .98 -- Allow a bit of slippage for targets running away.
  442.     local posX = predR.x + (ultVectorX * RRangeBuffered)
  443.     local posZ = predR.z + (ultVectorZ * RRangeBuffered)
  444.  
  445.     -- Thank you, Pythagoras
  446.     -- local distanceBetweenPoints = math.sqrt((predR.x - posX)^2 + (predR.z - posZ)^2)
  447.     -- local distanceBetweenPoints = GetDistance(Point(posX, posZ), predR)
  448.     -- local posXRanged = (posX + (posX - predR.x)) / distanceBetweenPoints * RRangeBuffered
  449.     -- local posZRanged = (posZ + (posZ - predR.z)) / distanceBetweenPoints * RRangeBuffered
  450.  
  451.     local predRPath = LineSegment(Point(predR.x, predR.z), Point(posX, posZ))
  452.  
  453.     local closestPoint = nil
  454.     if predRPath ~= nil then
  455.         closestPoint = Point(myHero.x, myHero.z):closestPoint(predRPath)
  456.     else
  457.         if debugMode then PrintChat("predRPath is nil") end
  458.     end
  459.  
  460.     if debugMode and closestPoint ~= nil then
  461.         --  PrintChat("moveto: "..posX..", "..posZ.."... targetat: "..ultCastTarget.x..", "..ultCastTarget.z..", ultVectorX: "..ultVectorX..", ultVectorZ: "..ultVectorZ..", RDuration: "..RDuration)
  462.         --  PrintChat("posXRanged: "..posXRanged..", posZRanged: "..posZRanged..", closestPoint: "..closestPoint.x..", "..closestPoint.y)
  463.         PrintChat("moveto: "..closestPoint.x..", "..closestPoint.y.."; targetat: "..predR.x..", "..predR.z..", ultVectorX: "..ultVectorX..", ultVectorZ: "..ultVectorZ)
  464.     end
  465.  
  466.     if debugMode then
  467.         PrintChat("distance: method 1: "..GetDistance(closestPoint, predR)..", method 2: "..GetDistance(Point(posX, posZ), predR))
  468.     end
  469.  
  470.     if predRPath ~= nil and closestPoint ~= nil and not IsWall(D3DXVECTOR3(closestPoint.x, myHero.y, closestPoint.y)) and GetDistance(closestPoint, predR) > ERange then
  471.         -- Closest Point Method
  472.         if debugMode then PrintChat("Move: Method 1") end
  473.         myHero:MoveTo(closestPoint.x, closestPoint.y)
  474.     elseif predR ~= nil and posX ~= nil and posZ ~= nil and not IsWall(D3DXVECTOR3(posX, myHero.y, posZ))
  475.         -- and GetDistance(Point(posX, posZ), predR) > 500
  476.         and GetDistance(Point(posX, posZ), predR) < RRange and GetDistance(Point(posX, posZ), predR) > 100 then
  477.         -- Full Vector Method
  478.         if debugMode then PrintChat("Move: Method 2") end
  479.         if (GetTickCount() > (lastUltMessage + 2000)) then
  480.             -- lastUltMessage = GetTickCount()
  481.             -- PrintFloatText(myHero, 10, "Ultimate Manual Mode!")
  482.         end
  483.         myHero:MoveTo(posX, posZ)
  484. --  elseif not IsWall(D3DXVECTOR3(posXRanged, myHero.y, posZRanged)) then
  485. --      -- Last Ditch Method
  486. --      if debugMode then PrintChat("Move: Method 3") end
  487. --      myHero:MoveTo(posXRanged, posZRanged)
  488.     else
  489.         -- Fallback to User Aiming
  490.         if debugMode then PrintChat("Move: Wall") end
  491.         myHero:MoveTo(mousePos.x, mousePos.z)
  492.     end
  493.     -- myHero:MoveTo(posXRanged, posZRanged)
  494. end
  495.  
  496. function getDistanceBetweenPoints(pointA, pointB)
  497.     -- Thank you, Pythagoras
  498.     local distanceBetweenPoints = math.sqrt((predR.x - posX)^2 + (predR.z - posZ)^2)
  499. end
  500.  
  501. function IsFiringUlt()
  502.     local tickCount = GetTickCount()
  503.  
  504.     -- if (ultCastTick > 0) and (tickCount >= ultCastTick) and (tickCount <= (ultCastTick + (RDuration * 1000))) and not RReady and ultCastTarget ~= nil and not ultCastTarget.dead then
  505.     if (ultCastTick > 0) and (tickCount >= ultCastTick) and isUltFiring and ultCastTarget ~= nil and not ultCastTarget.dead then
  506.         AutoCarry.CanMove = false
  507.         return true
  508.     else
  509.         UltFireStop()
  510.         return false
  511.     end
  512. end
  513.  
  514. function UltFireStop()
  515.     ultCastTick = 0
  516.     ultVectorX = nil
  517.     ultVectorZ = nil
  518.     AutoCarry.CanMove = true
  519. end
  520.  
  521. function isEnemyInRange(range)
  522.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  523.         if ValidTarget(enemy, range) and not enemy.dead then
  524.             return true
  525.         end
  526.     end
  527.  
  528.     return false
  529. end
  530.  
  531. --[[
  532. function TakingRapidDamage()
  533.     if GetTickCount() - healthLastTick > (AutoCarry.PluginMenu.HealthTime * 1000) then
  534.         --> Check amount of health lost
  535.         if myHero.health - healthLastHealth > myHero.maxHealth * (AutoCarry.PluginMenu.HealthPercentage / 100) then
  536.             return true
  537.         else
  538.             --> Reset counters
  539.             healthLastTick = GetTickCount()
  540.             healthLastHealth = myHero.health
  541.         end
  542.     end
  543. end
  544. --]]
  545.  
  546. function KillSteal()
  547.     -- Will try to perform a killsteam using any spell.
  548.     if not AutoCarry.PluginMenu.Killsteal then return end
  549.  
  550.     -- Killsteal disabled until Bol update for Lucian
  551.  
  552.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  553.         if enemy and not enemy.dead then
  554.             local qDmg = getDmg("Q", enemy, myHero)
  555.             local wDmg = getDmg("W", enemy, myHero)
  556.             local rDmg = getDmg("R", enemy, myHero)
  557.  
  558.  
  559.             local rDmg = getDmg("R", enemy, myHero)
  560.  
  561.             if QReady and ValidTarget(enemy, QRange) and (enemy.health + 20) < qDmg then
  562.                 if debugMode then PrintChat("Cast Q KS") end
  563.                 CastQ(enemy)
  564.             elseif WReady and ValidTarget(enemy, WRange) and (enemy.health + 20) < wDmg then
  565.                 if debugMode then PrintChat("Cast W KS") end
  566.                 CastW(enemy)
  567.             elseif AutoCarry.PluginMenu.KillstealUlt and RReady and ValidTarget(enemy, RRange) and (enemy.health + 20) < rDmg then
  568.                 if debugMode then PrintChat("Cast R KS") end
  569.                 CastR(enemy)
  570.             end
  571.  
  572.         end
  573.     end
  574. end
  575.  
  576. function PluginOnWndMsg(msg,key)
  577.     Target = AutoCarry.GetAttackTarget()
  578.     if Target ~= nil and AutoCarry.PluginMenu.ProMode then
  579.         -- if msg == KEY_DOWN and key == KeyQ then CastQ() end
  580.         if msg == KEY_DOWN and key == KeyW then CastW() end
  581.         if msg == KEY_DOWN and key == KeyE then CastE() end
  582.         if msg == KEY_DOWN and key == KeyR then CastR() end
  583.         if msg == KEY_DOWN and key == KeyTest and debugMode then
  584.             if ultVectorX == nil and ultVectorZ == nil then
  585.                 ultCastTarget = Target
  586.                 ultVectorX,y,ultVectorZ = (Vector(myHero) - Vector(ultCastTarget)):normalized():unpack()
  587.             end
  588.             MoveMyHeroToRPosition()
  589.         end
  590.        
  591.         if msg == KEY_UP and key == KeyTest and debugMode then
  592.             ultVectorX = nil
  593.             ultVectorZ = nil
  594.         end
  595.     end
  596. end
  597.  
  598. -- Draw
  599. function PluginOnDraw()
  600.     -- if Target ~= nil and not Target.dead and QReady and ValidTarget(Target, QMaxRange) then
  601.     if Target ~= nil and not Target.dead and (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
  602.         DrawArrowsToPos(myHero, Target)
  603.     end
  604.  
  605.     if not AutoCarry.PluginMenu.DisableDraw and not myHero.dead then
  606.         local farSpell = FindFurthestReadySpell()
  607.         -- if debugMode and farSpell then PrintChat("far: "..farSpell.configName) end
  608.  
  609.         DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x808080) -- Gray
  610.  
  611.         if AutoCarry.PluginMenu.DrawQ and QReady and ((AutoCarry.PluginMenu.DrawFurthest and farSpell and farSpell == SkillQ) or not AutoCarry.PluginMenu.DrawFurthest) then
  612.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x0099CC) -- Blue
  613.         end
  614.  
  615.         if AutoCarry.PluginMenu.DrawW and WReady and ((AutoCarry.PluginMenu.DrawFurthest and farSpell and farSpell == SkillW) or not AutoCarry.PluginMenu.DrawFurthest) then
  616.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFFFF00) -- Yellow
  617.         end
  618.        
  619.         if AutoCarry.PluginMenu.DrawE and EReady and ((AutoCarry.PluginMenu.DrawFurthest and farSpell and farSpell == SkillE) or not AutoCarry.PluginMenu.DrawFurthest) then
  620.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0x00FF00) -- Green
  621.         end
  622.  
  623.         if AutoCarry.PluginMenu.DrawR and RReady and ((AutoCarry.PluginMenu.DrawFurthest and farSpell and farSpell == SkillR) or not AutoCarry.PluginMenu.DrawFurthest) then
  624.             DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000) -- Red
  625.         end
  626.  
  627.         Target = AutoCarry.GetAttackTarget()
  628.         if Target ~= nil then
  629.             for j=0, 10 do
  630.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00) -- Green
  631.             end
  632.         end
  633.  
  634.     end
  635. end
  636.  
  637. function FindFurthestReadySpell()
  638.     local farSpell = nil
  639.  
  640.     if AutoCarry.PluginMenu.DrawQ and QReady then farSpell = SkillQ end
  641.     if AutoCarry.PluginMenu.DrawW and WReady and (not farSpell or WRange > farSpell.range) then farSpell = SkillW end
  642.     if AutoCarry.PluginMenu.DrawE and EReady and (not farSpell or ERange > farSpell.range) then farSpell = SkillE end
  643.     if AutoCarry.PluginMenu.DrawR and RReady and (not farSpell or RRange > farSpell.range) then farSpell = SkillR end
  644.  
  645.     return farSpell
  646. end
  647.  
  648. function DrawArrowsToPos(pos1, pos2)
  649.     if pos1 and pos2 then
  650.         startVector = D3DXVECTOR3(pos1.x, pos1.y, pos1.z)
  651.         endVector = D3DXVECTOR3(pos2.x, pos2.y, pos2.z)
  652.         -- directionVector = (endVector-startVector):normalized()
  653.         DrawArrows(startVector, endVector, 60, 0xE97FA5, 100)
  654.     end
  655. end
  656.  
  657. --[[
  658. class 'ColorARGB' -- {
  659.  
  660.     function ColorARGB:__init(red, green, blue, alpha)
  661.         self.R = red or 255
  662.         self.G = green or 255
  663.         self.B = blue or 255
  664.         self.A = alpha or 255
  665.     end
  666.  
  667.     function ColorARGB.FromArgb(red, green, blue, alpha)
  668.         return Color(red,green,blue, alpha)
  669.     end
  670.  
  671.     function ColorARGB:ToARGB()
  672.         return ARGB(self.A, self.R, self.G, self.B)
  673.     end
  674.  
  675.     ColorARGB.Red = ColorARGB(255, 0, 0, 255)
  676.     ColorARGB.Yellow = ColorARGB(255, 255, 0, 255)
  677.     ColorARGB.Green = ColorARGB(0, 255, 0, 255)
  678.     ColorARGB.Aqua = ColorARGB(0, 255, 255, 255)
  679.     ColorARGB.Blue = ColorARGB(0, 0, 255, 255)
  680.     ColorARGB.Fuchsia = ColorARGB(255, 0, 255, 255)
  681.     ColorARGB.Black = ColorARGB(0, 0, 0, 255)
  682.     ColorARGB.White = ColorARGB(255, 255, 255, 255)
  683. -- }
  684.  
  685. --Notification class
  686. class 'Message' -- {
  687.  
  688.     Message.instance = ""
  689.  
  690.     function Message:__init()
  691.         self.notifys = {}
  692.  
  693.         AddDrawCallback(function(obj) self:OnDraw() end)
  694.     end
  695.  
  696.     function Message.Instance()
  697.         if Message.instance == "" then Message.instance = Message() end return Message.instance
  698.     end
  699.  
  700.     function Message.AddMessage(text, color, target)
  701.         return Message.Instance():PAddMessage(text, color, target)
  702.     end
  703.  
  704.     function Message:PAddMessage(text, color, target)
  705.         local x = 0
  706.         local y = 200
  707.         local tempName = "Screen"
  708.         local tempcolor = color or ColorARGB.Red
  709.  
  710.         if target then  
  711.             tempName = target.networkID
  712.         end
  713.  
  714.         self.notifys[tempName] = { text = text, color = tempcolor, duration = GetGameTimer() + 2, object = target}
  715.     end
  716.  
  717.     function Message:OnDraw()
  718.         for i, notify in pairs(self.notifys) do
  719.             if notify.duration < GetGameTimer() then notify = nil
  720.             else
  721.                 notify.color.A = math.floor((255/2)*(notify.duration - GetGameTimer()))
  722.  
  723.                 if i == "Screen" then  
  724.                     local x = 0
  725.                     local y = 200
  726.                     local gameSettings = GetGameSettings()
  727.                     if gameSettings and gameSettings.General then
  728.                         if gameSettings.General.Width then x = gameSettings.General.Width/2 end
  729.                         if gameSettings.General.Height then y = gameSettings.General.Height/4 - 100 end
  730.                     end  
  731.                     --PrintChat(tostring(notify.color))
  732.                     local p = GetTextArea(notify.text, 40).x
  733.                     self:DrawTextWithBorder(notify.text, 40, x - p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  734.                 else    
  735.                     local pos = WorldToScreen(D3DXVECTOR3(notify.object.x, notify.object.y, notify.object.z))
  736.                     local x = pos.x
  737.                     local y = pos.y - 25
  738.                     local p = GetTextArea(notify.text, 40).x
  739.  
  740.                     self:DrawTextWithBorder(notify.text, 30, x- p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  741.                 end
  742.             end
  743.         end
  744.     end
  745.  
  746.     function Message:DrawTextWithBorder(textToDraw, textSize, x, y, textColor, backgroundColor)
  747.         DrawText(textToDraw, textSize, x + 1, y, backgroundColor)
  748.         DrawText(textToDraw, textSize, x - 1, y, backgroundColor)
  749.         DrawText(textToDraw, textSize, x, y - 1, backgroundColor)
  750.         DrawText(textToDraw, textSize, x, y + 1, backgroundColor)
  751.         DrawText(textToDraw, textSize, x , y, textColor)
  752.     end
  753. -- }
  754. --]]
Advertisement
Add Comment
Please, Sign In to add comment