a guest Apr 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MerchantsAndItems =
  2. {
  3.     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"},
  4.     BlueDjinn = {3030},
  5.     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"},
  6.     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", "Daramanian Mace", "Daramanian 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"},
  7. }
  9. BackpacksToSortTo =
  10. {
  11.     BlueDjinn = "Depot Box I",
  12.     GreenDjinn = "Depot Box II",
  13.     Rashid = "Depot Box III",
  14.     Others = "Depot Box IV",
  15.     Main = "Brocade Backpack"
  16. }
  18. function itemMoveHelper(contFrom, fromSpot, contTo)
  20.     print("Moving from %s spot %d to %s", contFrom:Name(), fromSpot, contTo:Name())
  21.     if (contTo:ItemCount() == contTo:ItemCapacity()) then --opens the next container
  22.         local openAt = contTo:ItemCount() - 1
  23.         if (Item.isContainer(contTo:GetItemData(openAt).id)) then
  24.             contTo:UseItem(openAt, true)
  25.             wait(1500)
  26.         else
  27.             print("No more room for items in %s. Please fix the problem and restart the script.", contTo:Name())
  28.             wait(99999999)
  29.         end
  30.     end
  32.     contFrom:MoveItemToContainer(fromSpot, contTo:Index(), contTo:ItemCapacity() - 1)
  33. end
  35. function itemFound(nameTable, itemId)
  36.     local itemName = string.upper(Item.GetName(itemId))
  37.     for _, name in pairs(nameTable) do
  38.         if (itemName == string.upper(name)) then
  39.             return true
  40.         end
  41.     end
  43.     return false
  44. end
  46. local error = false
  47. local backpacks = {}
  48. for merchant, bpName in pairs(BackpacksToSortTo) do
  49.     backpacks[merchant] = Container.GetByName(bpName)
  50.     if (not backpacks[merchant]:isOpen()) then
  51.         error = true
  52.         print("You must open a %s as your %s backpack. Please fix the problem and restart the script.", bpName, merchant)
  53.         break
  54.     end
  55. end
  57. if (not error) then
  58.     repeat
  60.         while (backpacks["Main"]:ItemCount() > 0) do
  61.             local item = backpacks["Main"]:GetItemData(0)
  63.             if (Item.isContainer( and backpacks["Main"]:ItemCount() == 1) then --open next backpack of loot
  64.                 backpacks["Main"]:UseItem(backpacks["Main"]:ItemCount()-1, true)
  65.                 wait(1000)
  66.                 break
  67.             else --move it the loot
  68.                 local foundBp = backpacks["Others"]
  69.                 for merchant, _ in pairs(MerchantsAndItems) do
  70.                     if (itemFound(MerchantsAndItems[merchant], then
  71.                         foundBp = backpacks[merchant]
  72.                         break
  73.                     end
  74.                 end
  76.                 itemMoveHelper(backpacks["Main"], 0, foundBp)
  77.                 wait(500, 900)
  78.             end
  79.         end
  80.     until (backpacks["Main"]:ItemCount() == 0)
  81. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand