Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setDefaultTab("Tools")
- -- config
- local toFollow = ""
- -- data
- local useId = {
- [34847] = true,
- [1764] = true,
- [21051] = true,
- [30823] = true,
- [6264] = true,
- [5282] = true,
- [20453] = true,
- [20454] = true,
- [20474] = true,
- [11708] = true,
- [11705] = true,
- [6257] = true,
- [6256] = true,
- [2772] = true,
- [27260] = true,
- [2773] = true,
- [1632] = true,
- [1633] = true,
- [1948] = true,
- [435] = true,
- [6252] = true,
- [6253] = true,
- [5007] = true,
- [4911] = true,
- [1629] = true,
- [1630] = true,
- [5108] = true,
- [5107] = true,
- [5281] = true,
- [1968] = true,
- [435] = true,
- [1948] = true,
- [5542] = true,
- [31116] = true,
- [31120] = true,
- [30742] = true,
- [31115] = true,
- [31118] = true,
- [20474] = true,
- [5737] = true,
- [5736] = true,
- [5734] = true,
- [5733] = true,
- [31202] = true,
- [31228] = true,
- [31199] = true,
- [31200] = true,
- [33262] = true,
- [30824] = true,
- [5125] = true,
- [5126] = true,
- [5116] = true,
- [5117] = true,
- [8257] = true,
- [8258] = true,
- [8255] = true,
- [8256] = true,
- [5120] = true,
- [30777] = true,
- [30776] = true,
- [23873] = true,
- [23877] = true,
- [5736] = true,
- [6264] = true,
- [31262] = true,
- [31130] = true,
- [31129] = true,
- [6250] = true,
- [6249] = true,
- [5122] = true,
- [30049] = true,
- [7131] = true,
- [7132] = true,
- [7727] = true
- }
- local shovelId = {
- [606] = true,
- [593] = true,
- [867] = true,
- [608] = true
- }
- local ropeId = {
- [17238] = true,
- [12202] = true,
- [12935] = true,
- [386] = true,
- [421] = true,
- [21966] = true,
- [14238] = true
- }
- local macheteId = {
- [2130] = true,
- [3696] = true
- }
- local scytheId = {
- [3653] = true
- }
- local tables = {useId, shovelId, ropeId, macheteId, scytheId}
- local settings = storage.extras
- local movementHistory = {}
- storage.vithraxFollow = storage.vithraxFollow or ''
- -- functions
- local function useAll()
- local tiles = getNearTiles(pos())
- table.insert(tiles, g_map.getTile(pos()))
- for _, tile in ipairs(tiles) do
- for __, item in ipairs(tile:getItems()) do
- local id = item:getId()
- for i, array in ipairs(tables) do
- if array[id] then
- if i == 1 then
- use(item)
- elseif i == 2 then
- useWith(settings.shovel, item)
- elseif i == 3 then
- useWith(settings.rope, item)
- elseif i == 4 then
- useWith(settings.machete, item)
- else
- useWith(settings.scythe, item)
- end
- return true
- end
- end
- end
- end
- return false
- end
- setDefaultTab("KT")
- local getOutfit = player:getOutfit()
- local playerOutfit = {
- type = getOutfit.type,
- head = getOutfit.head,
- body = getOutfit.body,
- legs = getOutfit.legs,
- feet = getOutfit.feet,
- addons = getOutfit.addons,
- --mount = getOutfit.mount
- }
- local followIcon = addIcon("holdFollow", {outfit=playerOutfit, movable=true, text = "Follow"},
- macro(75, "[Melee] Close Follow", function(macro)
- local target = getCreatureByName(storage.vithraxFollow)
- local tpos = target and target:getPosition()
- if tpos and getDistanceBetween(tpos,pos()) < 2 then
- movementHistory = {}
- return
- end
- local dest = movementHistory[posz()]
- if tpos and not dest then
- local path = findPath(tpos, pos(), 20, { ignoreNonPathable = true, precision = 1 })
- if path then
- dest = tpos
- end
- end
- if not dest then
- if useAll() then
- return
- end
- delay(100)
- end
- if dest and getDistanceBetween(dest, pos()) == 0 then
- delay(100)
- useAll()
- return
- end
- local path = findPath(pos(), dest, 20, { ignoreNonPathable = true, precision = 1 })
- if not path then
- useAll()
- delay(100)
- return
- end
- CaveBot.walkTo(dest, 20, { ignoreNonPathable = true, precision = target and 1 or 0 })
- end))
- UI.TextEdit(storage.vithraxFollow or 'Player Name', function(widget, newText)
- storage.vithraxFollow = newText
- end)
- onCreaturePositionChange(function(creature, oldPos, newPos)
- if not newPos then return end
- if creature:getName():lower() ~= storage.vithraxFollow:lower():trim() then return end
- -- register position on current floor
- movementHistory[newPos.z] = newPos
- end)
- UI.Separator()
- followIcon:setSize({height=55,width=50})
- followIcon.text:setFont('verdana-11px-rounded')
- followIcon.text:setTextOffset({x = 12, y = -8})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement