A very easy to set-up depositor that deposits your looting items directly into the depots depending on which npc that buys the item. The script does not deposit items from your main backpack and it does not deposit your supplies or your coins.
-- Depot numbers start at 1, not 0.
local Config = {
nonStacks = 1,
stacks = 2,
rashid = 3,
greenDjinn = 4,
blueDjinn = 5,
}
---------------------------------------------------
------------------ END OF CONFIG ------------------
---------------------------------------------------
-- Build up the custom destination table from the config and the npc data
local customDests = {}
for npc, items in pairs(npcItems) do
for _, name in ipairs(items) do
customDests[itemid(name)] = Config[npc]
end
end
-- Save precious bp settings before disabling
local previousSettings = getsetting('Looting/OpenNextBP')
setsetting('Looting/OpenNextBP', 'no')
-- Reset bps
local function resetBackpacks()
pausewalking(20000)
closewindows()
waitping()
openitem($back.id,'back')
waitping()
local function openBackpack(bp)
while windowcount(bp) == 0 do
openitem(bp, $back.id, true)
waitping()
resizewindows()
waitping()
end
end
local cont = getcontainer(0)
for itemIndex = 1, cont.itemcount do
local item = cont.item[itemIndex]
if iteminfo(item.id).iscontainer then
openBackpack(itemname(item.id))
end
end
pausewalking(0)
end
resetBackpacks()
-- Open the locker
while windowcount('Locker') == 0 do
opendepot(true)
waitping()
end
-- Open the depot
while windowcount('Depot') == 0 do
openitem(3502)
waitping()
end
local function depositItemsFromOneBp(srcbp, lootdp, stacksdp, customDestinations, blacklist)
local function moveItemToDp(id, dp)
local depotid = 22796 + dp
moveitemsonto(id, depotid, 1, 'depot chest', srcbp)
waitping()
end
local notEmpty = getcontainer(srcbp).itemcount > 1
foreach lootingitem item do
if not blacklist[item.id] then
local destination = customDestinations[item.id] or (itemproperty(item.id, ITEM_STACKABLE ) and stacksdp) or lootdp
while itemcount(item.id, srcbp) > 0 do
moveItemToDp(item.id, destination)
end
end
end
if itemcount(srcbp, srcbp) > 0 and itemcount('gold coin', srcbp) < 1900 and notEmpty then
openitem(srcbp, srcbp, false)
waitcontainer(lootingBp, false)
depositItemsFromOneBp(srcbp, lootdp, stacksdp, customDestinations, blacklist)
end
end
function depositItems(lootdp, stacksdp, customDestinations, blacklist)
for i = 1, 15 do
local cont = getcontainer(i)
if cont.isopen then
depositItemsFromOneBp(cont.name, lootdp, stacksdp, customDestinations, blacklist)
end
end
end
-- Build up a blacklist from our supplylist
local blacklist = {
[3031] = true,
[3035] = true,
[3043] = true,
}
foreach supplyitem item do
blacklist[item.id] = true
end
-- Call the deposit function
depositItems(Config.nonStacks, Config.stacks, customDests, blacklist)
resetBackpacks()
-- And finally, restore the previous settings
setsetting('Looting/OpenNextBP', previousSettings)
09-16-2016, 05:59 PM
Cisco
Very good :cool:
09-16-2016, 06:44 PM
shAdOwArt
Woops, forgot to blacklist gold and plats. That has been fixed now.
09-17-2016, 05:57 PM
shAdOwArt
Updated with a different way of resetting the backpacks that works even when the client is minimized.
09-25-2016, 06:38 PM
Sea
What backpack does this deposit loot from or all backpacks in ur backpack are openend?
09-25-2016, 07:07 PM
Sea
oops double
09-26-2016, 06:48 AM
shAdOwArt
Til that ITEMPROPERTIES_STACKABLE and ITEM_STACKABLE are different things. Finally fixed the sorting of stackables.
09-27-2016, 09:11 AM
shAdOwArt
Updated again. The depositor will no longer recursively search backpacks that either only contain another backpack (are empty), or contain 1900 gold coins. This greatly reduces the time needed to deposit items.
09-29-2016, 04:32 PM
nigum
Why this action dont deposit tribal mask?
09-29-2016, 04:40 PM
shAdOwArt
Read the description. Either its not on your loot list, or it's in your main backpack.