Kain2030

Auto Carry Plugin - Lucian Edition - v1.06c

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