Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Auto Carry Plugin - Lucian Edition
- Author: Kain
- Version: 1.05d Beta
- Copyright 2013
- Dependency: Sida's Auto Carry: Revamped
- How to install:
- Make sure you already have AutoCarry installed.
- Name the script EXACTLY "SidasAutoCarryPlugin - Lucian.lua" without the quotes.
- Place the plugin in BoL/Scripts/Common folder.
- Version History:
- Version: 1.05 Pre-Release:
- Fixing issues with Ultimate ending early.
- Version: 1.04 Beta Pre-Release: http://pastebin.com/ayEX5Bfq
- Culling Lockon added. Considered experimental, but seems to be working pretty well.
- Version: 1.02 Beta Pre-Release: http://pastebin.com/tXxr95g9
- Version: 1.0 Alpha: http://pastebin.com/xWbRz89K
- --]]
- if myHero.charName ~= "Lucian" then return end
- local Target
- -- Prediction
- -- Confirm ranges on release.
- local QRange = 550
- local QMaxRange = 1100
- local WRange = 1000
- local ERange = 425
- local RRange = 1400
- local QSpeed = 19.346
- local WSpeed = 1.009
- local ESpeed = 3.867
- local RSpeed = 1.3
- local QWidth = 250
- local WWidth = 250
- local EWidth = 250
- local RWidth = 250
- local QDelay = 405
- local WDelay = 256
- local EDelay = 1070
- local RDelay = 143
- local RRefresh = 0.1
- local RDuration = 3.2 -- Old: 3.0 2.871 - 3.167
- local RParticleProjectileName = "Lucian_R_mis.troy"
- local RParticleProjectileNameOld = "bowMaster_volley_mis.troy"
- local RParticle = "Lucian_R_tar.troy"
- local RParticleFiring = "Lucian_R_self.troy"
- local PursuitMinMouseDiff = 500
- local 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 }
- local 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 }
- local 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 }
- local 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 }
- local KeyQ = string.byte("Q")
- local KeyW = string.byte("W")
- local KeyE = string.byte("E")
- local KeyR = string.byte("R")
- local KeyTest = string.byte("U")
- local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
- local QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, IReady = false, false, false, false, false, false, false, false
- local ultCastTick = 0
- local ultCastTarget = nil
- local ultVectorX = nil
- local ultVectorZ = nil
- local isUltFiring = false
- local lastUltMessage = 0
- local debugMode = false
- local debugModeDisableNonR = false
- function PluginOnLoad()
- Menu()
- AutoCarry.SkillsCrosshair.range = QMaxRange
- end
- function Menu()
- -- AutoCarry.PluginMenu:addParam("fullcombo", "Full Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
- AutoCarry.PluginMenu:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
- AutoCarry.PluginMenu:addParam("AutoHarass", "Auto Harass", SCRIPT_PARAM_ONOFF, false)
- AutoCarry.PluginMenu:addParam("UseE", "Pursuit in Combo", SCRIPT_PARAM_ONOFF, true)
- AutoCarry.PluginMenu:addParam("Ultimate", "Use Ultimate with Combo", SCRIPT_PARAM_ONOFF, true)
- AutoCarry.PluginMenu:addParam("Killsteal", "Killsteal (Disabled until BoL update)", SCRIPT_PARAM_ONOFF, true)
- AutoCarry.PluginMenu:addParam("KillstealUlt", "Killsteal with Ult", SCRIPT_PARAM_ONOFF, false)
- AutoCarry.PluginMenu:addParam("UltLockOn", "Use Ultimate Lock On (Beta)", SCRIPT_PARAM_ONOFF, true)
- AutoCarry.PluginMenu:addParam("Draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
- end
- function PluginOnTick()
- Target = AutoCarry.GetAttackTarget(true)
- SpellCheck()
- -- GetTickCount() % 5 == 0) and
- if math.fmod(GetTickCount(), 25) and IsFiringUlt() then
- CheckRPosition()
- else
- if (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
- Combo()
- end
- --[[
- if AutoCarry.PluginMenu.fullcombo then
- FullCombo()
- end
- --]]
- if AutoCarry.PluginMenu.Harass then
- Harass()
- end
- if AutoCarry.PluginMenu.Killsteal then
- KillSteal()
- end
- end
- end
- function PluginOnCreateObj(obj)
- -- Nothing to do here.
- if obj.name == RParticleFiring then
- if debugMode then PrintChat("Ult Particle Started") end
- isUltFiring = true
- if debugMode then PrintChat("start: "..GetTickCount()) end
- end
- end
- function PluginOnDeleteObj(obj)
- if obj.name == RParticleFiring then
- if debugMode then PrintChat("Ult Particle Stopped") end
- isUltFiring = false
- UltFireStop()
- if debugMode then PrintChat("stop: "..GetTickCount()) end
- end
- end
- function OnAttacked()
- -- AA > Q > AA
- if AutoCarry.PluginMenu.AutoHarass then CastQ() end
- end
- --[[
- function CustomAttackEnemy(enemy)
- if enemy.dead or not enemy.valid then return end
- -- myHero:Attack(enemy)
- -- AutoCarry.shotFired = true
- end
- --]]
- --[[
- function PluginOnGainBuff(unit, buff)
- if unit.name == myHero.name and buff.name == "Lightslinger" and Target ~= nil then
- myHero:Attack(Target)
- end
- end
- --]]
- function SpellCheck()
- DFGSlot, HXGSlot, BWCSlot, BRKSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
- GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3153), GetInventorySlotItem(3057),
- GetInventorySlotItem(3078), GetInventorySlotItem(3100)
- QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
- WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
- EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
- RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
- DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
- HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
- BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
- BRKReady = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
- IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
- end
- -- Handle SBTW Skill Shots
- function Combo()
- if not debugModeDisableNonR then
- CastSlots()
- if AutoCarry.PluginMenu.UseE then CastE() end
- CastQ()
- CastW()
- end
- if AutoCarry.PluginMenu.Ultimate then
- CastR()
- end
- end
- function FullCombo()
- CastSlots()
- CastE()
- CastQ()
- CastW()
- if AutoCarry.PluginMenu.Ultimate then
- CastR()
- end
- end
- function CastSlots()
- if Target ~= nil then
- if GetDistance(Target) <= QRange then
- if DFGReady then CastSpell(DFGSlot, Target) end
- if HXGReady then CastSpell(HXGSlot, Target) end
- if BWCReady then CastSpell(BWCSlot, Target) end
- if BRKReady then CastSpell(BRKSlot, Target) end
- end
- end
- end
- function Harass()
- CastQ()
- end
- function CastQ(enemy)
- -- Q (Piercing Light)
- if not enemy then enemy = Target end
- if enemy ~= nil and QReady and ValidTarget(enemy, QRange) then
- if debugMode then PrintChat("Cast Q") end
- CastSpell(SkillQ.spellKey, enemy)
- end
- end
- function CastW(enemy)
- -- W (Ardent Blaze)
- if not enemy then enemy = Target end
- if enemy ~= nil and WReady and ValidTarget(enemy, WRange) then
- if debugMode then PrintChat("Cast W") end
- AutoCarry.CastSkillshot(SkillW, enemy)
- end
- end
- function CastE()
- -- E (Relentless Pursuit)
- if debugMode then
- -- PrintChat("Mouse Distance: "..GetDistance(mousePos))
- end
- if EReady then
- -- if ( math.abs(mousePos.x - myHero.x) > PursuitMinMouseDiff or math.abs(mousePos.z - myHero.z) > PursuitMinMouseDiff) then
- if ((GetDistance(mousePos) > PursuitMinMouseDiff) and isEnemyInRange(SkillE.range + SkillR.range)) then
- if debugMode then PrintChat("Cast E") end
- CastSpell(SkillE.spellKey, mousePos.x, mousePos.z)
- end
- end
- end
- function CastR(enemy)
- if not enemy then enemy = Target end
- -- R (The Culling)
- if enemy ~= nil and RReady and ValidTarget(enemy, RRange) then
- if not IsFiringUlt() then
- if debugMode then PrintChat("Cast R") end
- if not isUltFiring then
- AutoCarry.CastSkillshot(SkillR, enemy)
- if AutoCarry.PluginMenu.UltLockOn and GetTickCount() > (lastUltMessage + 2000) then
- lastUltMessage = GetTickCount()
- PrintFloatText(myHero, 10, "Ultimate Locked On!")
- end
- end
- ultCastTarget = enemy
- ultCastTick = GetTickCount()
- -- Vector from target -> myHero
- if ultVectorX == nil and ultVectorZ == nil then
- if debugMode and false then PrintChat("update x,z") end
- ultVectorX,y,ultVectorZ = (Vector(myHero) - Vector(ultCastTarget)):normalized():unpack()
- end
- end
- CheckRPosition()
- end
- end
- function CheckRPosition()
- if (ultCastTick > 0) then
- if debugMode and IsFiringUlt() then burp = "true" else burp = "false" end
- if debugMode and false then PrintChat("Tick: "..GetTickCount()..", ultCastTick: "..ultCastTick..", RDuration: "..(ultCastTick + (RDuration * 1000))..", IsFiringUlt: "..burp) end
- end
- if AutoCarry.PluginMenu.UltLockOn and IsFiringUlt() then
- MoveMyHeroToRPosition()
- end
- end
- function MoveMyHeroToRPosition()
- -- Please don't steal this function!
- local tpR = VIP_USER and TargetPredictionVIP(RRange, RSpeed*1000, RRefresh, RWidth) or TargetPrediction(RRange, RSpeed, RRefresh*1000, RWidth)
- local target = nil
- if ultCastTarget ~= nil then
- target = ultCastTarget
- else
- target = Target
- end
- local predR = tpR:GetPrediction(target)
- if not predR then return end
- local RRangeBuffered = RRange * .98 -- Allow a bit of slippage for targets running away.
- local posX = predR.x + (ultVectorX * RRangeBuffered)
- local posZ = predR.z + (ultVectorZ * RRangeBuffered)
- -- Thank you, Pythagoras
- -- local distanceBetweenPoints = math.sqrt((predR.x - posX)^2 + (predR.z - posZ)^2)
- -- local distanceBetweenPoints = GetDistance(Point(posX, posZ), predR)
- -- local posXRanged = (posX + (posX - predR.x)) / distanceBetweenPoints * RRangeBuffered
- -- local posZRanged = (posZ + (posZ - predR.z)) / distanceBetweenPoints * RRangeBuffered
- local predRPath = LineSegment(Point(predR.x, predR.z), Point(posX, posZ))
- local closestPoint = nil
- if predRPath ~= nil then
- closestPoint = Point(myHero.x, myHero.z):closestPoint(predRPath)
- else
- if debugMode then PrintChat("predRPath is nil") end
- end
- if debugMode and closestPoint ~= nil then
- -- PrintChat("moveto: "..posX..", "..posZ.."... targetat: "..ultCastTarget.x..", "..ultCastTarget.z..", ultVectorX: "..ultVectorX..", ultVectorZ: "..ultVectorZ..", RDuration: "..RDuration)
- -- PrintChat("posXRanged: "..posXRanged..", posZRanged: "..posZRanged..", closestPoint: "..closestPoint.x..", "..closestPoint.y)
- PrintChat("moveto: "..closestPoint.x..", "..closestPoint.y.."; targetat: "..predR.x..", "..predR.z..", ultVectorX: "..ultVectorX..", ultVectorZ: "..ultVectorZ)
- end
- if debugMode then
- PrintChat("distance: method 1: "..GetDistance(closestPoint, predR)..", method 2: "..GetDistance(Point(posX, posZ), predR))
- end
- if predRPath ~= nil and closestPoint ~= nil and not IsWall(D3DXVECTOR3(closestPoint.x, myHero.y, closestPoint.y)) and GetDistance(closestPoint, predR) > ERange then
- -- Closest Point Method
- if debugMode then PrintChat("Move: Method 1") end
- myHero:MoveTo(closestPoint.x, closestPoint.y)
- elseif predR ~= nil and posX ~= nil and posZ ~= nil and not IsWall(D3DXVECTOR3(posX, myHero.y, posZ))
- -- and GetDistance(Point(posX, posZ), predR) > 500
- and GetDistance(Point(posX, posZ), predR) < RRange and GetDistance(Point(posX, posZ), predR) > 100 then
- -- Full Vector Method
- if debugMode then PrintChat("Move: Method 2") end
- if (GetTickCount() > (lastUltMessage + 2000)) then
- -- lastUltMessage = GetTickCount()
- -- PrintFloatText(myHero, 10, "Ultimate Manual Mode!")
- end
- myHero:MoveTo(posX, posZ)
- -- elseif not IsWall(D3DXVECTOR3(posXRanged, myHero.y, posZRanged)) then
- -- -- Last Ditch Method
- -- if debugMode then PrintChat("Move: Method 3") end
- -- myHero:MoveTo(posXRanged, posZRanged)
- else
- -- Fallback to User Aiming
- if debugMode then PrintChat("Move: Wall") end
- myHero:MoveTo(mousePos.x, mousePos.z)
- end
- -- myHero:MoveTo(posXRanged, posZRanged)
- end
- function getDistanceBetweenPoints(pointA, pointB)
- -- Thank you, Pythagoras
- local distanceBetweenPoints = math.sqrt((predR.x - posX)^2 + (predR.z - posZ)^2)
- end
- function IsFiringUlt()
- local tickCount = GetTickCount()
- -- if (ultCastTick > 0) and (tickCount >= ultCastTick) and (tickCount <= (ultCastTick + (RDuration * 1000))) and not RReady and ultCastTarget ~= nil and not ultCastTarget.dead then
- if (ultCastTick > 0) and (tickCount >= ultCastTick) and isUltFiring and ultCastTarget ~= nil and not ultCastTarget.dead then
- AutoCarry.CanMove = false
- return true
- else
- UltFireStop()
- return false
- end
- end
- function UltFireStop()
- ultCastTick = 0
- ultVectorX = nil
- ultVectorZ = nil
- AutoCarry.CanMove = true
- end
- function isEnemyInRange(range)
- for _, enemy in pairs(AutoCarry.EnemyTable) do
- if ValidTarget(enemy, range) and not enemy.dead then
- return true
- end
- end
- return false
- end
- function KillSteal()
- -- Will try to perform a killsteam using any spell.
- if not AutoCarry.PluginMenu.Killsteal then return end
- -- Killsteal disabled until Bol update for Lucian
- --[[
- for _, enemy in pairs(AutoCarry.EnemyTable) do
- if enemy and not enemy.dead then
- local qDmg = getDmg("Q", enemy, myHero)
- local wDmg = getDmg("W", enemy, myHero)
- local rDmg = getDmg("R", enemy, myHero)
- local rDmg = getDmg("R", enemy, myHero)
- if QReady and ValidTarget(enemy, QRange) and (enemy.health + 20) < qDmg then
- if debugMode then PrintChat("Cast Q KS") end
- CastQ(enemy)
- elseif WReady and ValidTarget(enemy, WRange) and (enemy.health + 20) < wDmg then
- if debugMode then PrintChat("Cast W KS") end
- CastW(enemy)
- elseif AutoCarry.PluginMenu.KillstealUlt and RReady and ValidTarget(enemy, RRange) and (enemy.health + 20) < rDmg then
- if debugMode then PrintChat("Cast R KS") end
- CastR(enemy)
- end
- end
- end
- --]]
- end
- function PluginOnWndMsg(msg,key)
- Target = AutoCarry.GetAttackTarget()
- if Target ~= nil then
- -- if msg == KEY_DOWN and key == KeyQ then CastQ() end
- if msg == KEY_DOWN and key == KeyW then CastW() end
- if msg == KEY_DOWN and key == KeyE then CastE() end
- if msg == KEY_DOWN and key == KeyR then CastR() end
- if msg == KEY_DOWN and key == KeyTest and debugMode then
- if ultVectorX == nil and ultVectorZ == nil then
- ultCastTarget = Target
- ultVectorX,y,ultVectorZ = (Vector(myHero) - Vector(ultCastTarget)):normalized():unpack()
- end
- MoveMyHeroToRPosition()
- end
- if msg == KEY_UP and key == KeyTest and debugMode then
- ultVectorX = nil
- ultVectorZ = nil
- end
- end
- end
- -- Drawing
- function PluginOnDraw()
- if debugMode and false then
- if RReady and CanCast(_R) then
- PrintFloatText(myHero, 10, "R IS Ready!")
- else
- PrintFloatText(myHero, 10, "R NOT Ready!")
- end
- end
- if AutoCarry.PluginMenu.Draw then
- DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x808080) -- Gray
- if myHero:CanUseSpell(SkillQ.spellKey) then
- DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x0099CC) -- Blue
- end
- if myHero:CanUseSpell(SkillW.spellKey) then
- DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFFFF00) -- Yellow
- end
- if myHero:CanUseSpell(SkillE.spellKey) then
- DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0x00FF00) -- Green
- end
- if myHero:CanUseSpell(SkillR.spellKey) then
- DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000) -- Red
- end
- Target = AutoCarry.GetAttackTarget()
- if Target ~= nil then
- for j=0, 10 do
- DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00) -- Green
- end
- end
- end
- end
- --[[
- class 'ColorARGB' -- {
- function ColorARGB:__init(red, green, blue, alpha)
- self.R = red or 255
- self.G = green or 255
- self.B = blue or 255
- self.A = alpha or 255
- end
- function ColorARGB.FromArgb(red, green, blue, alpha)
- return Color(red,green,blue, alpha)
- end
- function ColorARGB:ToARGB()
- return ARGB(self.A, self.R, self.G, self.B)
- end
- ColorARGB.Red = ColorARGB(255, 0, 0, 255)
- ColorARGB.Yellow = ColorARGB(255, 255, 0, 255)
- ColorARGB.Green = ColorARGB(0, 255, 0, 255)
- ColorARGB.Aqua = ColorARGB(0, 255, 255, 255)
- ColorARGB.Blue = ColorARGB(0, 0, 255, 255)
- ColorARGB.Fuchsia = ColorARGB(255, 0, 255, 255)
- ColorARGB.Black = ColorARGB(0, 0, 0, 255)
- ColorARGB.White = ColorARGB(255, 255, 255, 255)
- -- }
- --Notification class
- class 'Message' -- {
- Message.instance = ""
- function Message:__init()
- self.notifys = {}
- AddDrawCallback(function(obj) self:OnDraw() end)
- end
- function Message.Instance()
- if Message.instance == "" then Message.instance = Message() end return Message.instance
- end
- function Message.AddMessage(text, color, target)
- return Message.Instance():PAddMessage(text, color, target)
- end
- function Message:PAddMessage(text, color, target)
- local x = 0
- local y = 200
- local tempName = "Screen"
- local tempcolor = color or ColorARGB.Red
- if target then
- tempName = target.networkID
- end
- self.notifys[tempName] = { text = text, color = tempcolor, duration = GetGameTimer() + 2, object = target}
- end
- function Message:OnDraw()
- for i, notify in pairs(self.notifys) do
- if notify.duration < GetGameTimer() then notify = nil
- else
- notify.color.A = math.floor((255/2)*(notify.duration - GetGameTimer()))
- if i == "Screen" then
- local x = 0
- local y = 200
- local gameSettings = GetGameSettings()
- if gameSettings and gameSettings.General then
- if gameSettings.General.Width then x = gameSettings.General.Width/2 end
- if gameSettings.General.Height then y = gameSettings.General.Height/4 - 100 end
- end
- --PrintChat(tostring(notify.color))
- local p = GetTextArea(notify.text, 40).x
- self:DrawTextWithBorder(notify.text, 40, x - p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
- else
- local pos = WorldToScreen(D3DXVECTOR3(notify.object.x, notify.object.y, notify.object.z))
- local x = pos.x
- local y = pos.y - 25
- local p = GetTextArea(notify.text, 40).x
- self:DrawTextWithBorder(notify.text, 30, x- p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
- end
- end
- end
- end
- function Message:DrawTextWithBorder(textToDraw, textSize, x, y, textColor, backgroundColor)
- DrawText(textToDraw, textSize, x + 1, y, backgroundColor)
- DrawText(textToDraw, textSize, x - 1, y, backgroundColor)
- DrawText(textToDraw, textSize, x, y - 1, backgroundColor)
- DrawText(textToDraw, textSize, x, y + 1, backgroundColor)
- DrawText(textToDraw, textSize, x , y, textColor)
- end
- -- }
- --]]
Advertisement
Add Comment
Please, Sign In to add comment