Description
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 ------------------
---------------------------------------------------
-- The npc data that will be used to build up the destination list
local npcItems = {
rashid = {"Abyss Hammer", "Amber Staff", "Ancient Amulet", "Assassin Dagger", "Bandana", "Beastslayer Axe", "Beetle Necklace", "Berserker", "Blacksteel Sword", "Blessed Sceptre", "Bone Shield", "Bonelord Helmet", "Brutetamer's Staff", "Castle Shield", "Chaos Mace", "Coconut Shoes", "Composite Hornbow", "Cranial Basher", "Crocodile Boots", "Crystal Mace", "Crystal Necklace", "Crystal Ring", "Crystal Sword", "Crystalline Armor", "Daramian Mace", "Daramian Waraxe", "Dark Shield", "Death Ring", "Demon Shield", "Demonbone Amulet", "Demonrage Sword", "Devil Helmet", "Diamond Sceptre", "Doll", "Dragon Scale Mail", "Dragon Slayer", "Dragonbone Staff", "Dreaded Cleaver", "Earth Cranial Basher", "Earth Dragon Slayer", "Earth Heroic Axe", "Earth Mystic Blade", "Earth Relic Sword", "Earth War Axe", "Elvish Bow", "Emerald Bangle", "Energy Cranial Basher", "Energy Dragon Slayer", "Energy Heroic Axe", "Energy Mystic Blade", "Energy Relic Sword", "Energy War Axe", "Epee", "Fiery Cranial Basher", "Fiery Dragon Slayer", "Fiery Heroic Axe", "Fiery Mystic Blade", "Fiery Relic Sword", "Fiery War Axe", "Flower Dress", "Flower Wreath", "Fur Boots", "Furry Club", "Glacier Amulet", "Glacier Kilt", "Glacier Mask", "Glacier Robe", "Glacier Shoes", "Gold Ring", "Golden Armor", "Golden Legs", "Guardian Halberd", "Hammer of Wrath", "Heavy Mace", "Heavy Machete", "Heavy Trident", "Heroic Axe", "Hibiscus Dress", "Icy Cranial Basher", "Icy Dragon Slayer", "Icy Heroic Axe", "Icy Mystic Blade", "Icy Relic Sword", "Icy War Axe", "Jade Hammer", "Krimhorn Helmet", "Leaf Legs", "Leopard Armor", "Leviathan's Amulet", "Light Shovel", "Lightning Boots", "Lightning Headband", "Lightning Legs", "Lightning Pendant", "Lightning Robe", "Lunar Staff", "Magic Plate Armor", "Magma Amulet", "Magma Boots", "Magma Coat", "Magma Legs", "Magma Monocle", "Mammoth Fur Cape", "Mammoth Fur Shorts", "Mammoth Whopper", "Mastermind Shield", "Medusa Shield", "Mercenary Sword", "Mystic Blade", "Naginata", "Nightmare Blade", "Noble Axe", "Norse Shield", "Orcish Maul", "Paladin Armor", "Pirate Boots", "Pirate Hat", "Pirate Knee Breeches", "Pirate Shirt", "Pirate Voodoo Doll", "Platinum Amulet", "Ragnir Helmet", "Relic Sword", "Ring of the Sky", "Ruby Necklace", "Ruthless Axe", "Sacred Tree Amulet", "Sapphire Hammer", "Scarab Amulet", "Scarab Shield", "Shockwave Amulet", "Silver Brooch", "Silver Dagger", "Skull Helmet", "Skullcracker Armor", "Spiked Squelcher", "Steel Boots", "Swamplair Armor", "Taurus Mace", "Terra Amulet", "Terra Boots", "Terra Hood", "Terra Legs", "Terra Mantle", "The Justice Seeker", "Tortoise Shield", "Vile Axe", "Voodoo Doll", "War Axe", "War Horn", "Witch Hat", "Wyvern Fang"},
greenDjinn = {"Ancient Shield", "Black Shield", "Bonebreaker", "Dark Armor", "Dark Helmet", "Dragon Hammer", "Dreaded Cleaver", "Earth Knight Axe", "Energy Knight Axe", "Fiery Knight Axe", "Giant Sword", "Haunted Blade", "Icy Knight Axe", "Knight Armor", "Knight Axe", "Knight Legs", "Mystic Turban", "Onyx Flail", "Poison Dagger", "Scimitar", "Serpent Sword", "Skull Staff", "Strange Helmet", "Titan Axe", "Tower Shield", "Vampire Shield", "Warrior Helmet", "Hailstorm Rod", "Moonlight Rod", "Mysterious Fetish", "Necrotic Rod", "Northwind Rod", "Snakebite Rod", "Springsprout Rod", "Strange Talisman", "Terra Rod", "Underworld Rod"},
blueDjinn = {"Magic Light Wand", "Orb", "Wand of Cosmic Energy", "Wand of Decay", "Wand of Draconia", "Wand of Dragonbreath", "Wand of Inferno", "Wand of Starstorm", "Wand of Voodoo", "Wand of Vortex", "Angelic Axe", "Blue Robe", "Bonelord Shield", "Boots of Haste", "Broadsword", "Butcher's Axe", "Crown Armor", "Crown Helmet", "Crown Legs", "Crown Shield", "Crusader Helmet", "Dragon Lance", "Dragon Shield", "Earth Spike Sword", "Earth War Hammer", "Energy Spike Sword", "Energy War Hammer", "Fiery Spike Sword", "Fiery War Hammer", "Fire Axe", "Fire Sword", "Glorious Axe", "Guardian Shield", "Ice Rapier", "Icy Spike Sword", "Icy War Hammer", "Noble Armor", "Obsidian Lance", "Queen's Sceptre", "Royal Helmet", "Shadow Sceptre", "Spike Sword", "Thaian Sword", "War Hammer"},
}
-- 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)