vBot item loot list
#70
Add these to the targetbot\looting.lua file
These are just examples and I will not be supporting them.
If you don't know how they work then you have no need to use them.
These are just examples and I will not be supporting them.
If you don't know how they work then you have no need to use them.
--[[
Script made by Lee (Discord: l33_) - www.trainorcreations.com
If you want to support my work, feel free to donate at https://trainorcreations.com/donate
PS. Stop ripping off my work and selling it as your own.
]]--
-- This clears the loot item list.
UI.Button("Clear Loot List", function()
ui.items:setItems({})
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end)
-- This will auto add any item to the loot list that is in a container that is opened whilst the macro is enabled.
-- I do not recommend you bot with this enabled but its good for starting a list of items from mobs in a spawn.itemsById
autoAdd = macro(10000, "Auto Track","F1", function() end)
onContainerOpen(function(container, previousContainer)
local doUpdate = false
if autoAdd:isOff() then return end
if previousContainer then return end
itemsById = {}
addedItemsById = {}
items = ui.items:getItems()
for i, item in ipairs(items) do
table.insert(itemsById,item.id)
end
for i, item in ipairs(container:getItems()) do
if not table.contains(itemsById, item:getId()) then
table.insert(addedItemsById,item:getId())
doUpdate = true
end
end
if doUpdate then
for i=1,#itemsById do
table.insert(addedItemsById , itemsById[i])
end
ui.items:setItems(addedItemsById)
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end
end)
-- this adds the item that is under the mouse on the floor to the auto loot list.
hotkey("F2", "Add item under mouse", function()
local tile = getTileUnderCursor()
if tile then
local fitem = tile:getTopLookThing()
if fitem then
items = ui.items:getItems()
itemsById = {}
table.insert(itemsById,fitem:getId())
for i, item in ipairs(items) do
table.insert(itemsById,item.id)
end
ui.items:setItems(itemsById)
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end
end
end)
-- this will add all items in open loot containers
-- use for building new lists after clear.
hotkey("F3", "Add items from open containers", function()
itemsById = {}
items = ui.items:getItems()
for i, item in ipairs(items) do
table.insert(itemsById,item.id)
end
for index, container in pairs(getContainers()) do
if containersById[container:getContainerItem():getId()] and not container.lootContainer then
for slot, item in ipairs(container:getItems()) do
if not table.contains(itemsById, item:getId()) then
table.insert(itemsById,item:getId())
end
end
end
end
ui.items:setItems(itemsById)
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end)
11 Nov 2021