Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro(300, "Reward chest", function()
- local rewardChest = 19250
- local rewardBag = 19202
- local rewardBagTotal = 0
- local rewardBagCount = 1
- local itemsToKeep = {}
- local itemsToDrop = {}
- local lootBp = 2869 --change this to the backpack you want items to move too
- --For every container open, get information on open containers
- for i, container in pairs(getContainers()) do
- --Get the IDs of every open container
- containerId = container:getContainerItem():getId()
- --If the containerId is equal to reward chest id then
- if containerId == rewardChest then
- --Set rewardBagCount = items in rewardChest
- rewardBagTotal = container:getItemsCount()
- repeat
- --For each rewardBag in rewardChest
- for j, item in ipairs(container:getItems()) do
- --Open the first bag and increase count by 1 until all bags equal rewardBagTotal
- g_game.open(item, container:getSlotPosition(rewardBagCount))
- rewardBagCount = rewardBagCount + 1
- --For every open container do
- for i, container in pairs(getContainers()) do
- containerBagId = container:getContainerItem():getId()
- --If reward bag is open then
- if containerBagId == rewardBag then
- --For each item in reward bag
- for l, item in ipairs(container:getItems()) do
- --If the reward bag has items in it then
- if container:getItemsCount() > 0 then
- ----If the item id is found in itemsToKeep then
- --if table.find(itemsToKeep, item:getId()) then
- --For every container open
- for k, container in pairs(getContainers()) do
- --Store container ids in this variable
- containerLootBp = container:getContainerItem():getId()
- --If containerLootBp ever matches lootBp
- if containerLootBp == lootBp then
- --Move the item from rewardbag to loot bag
- g_game.move(item, container:getSlotPostion(19))
- end
- end
- --end
- --If the item id is found in itemsToKeep then
- --if table.find(itemsToDrop, item:getId()) then
- --g_game.move(to floor)
- --g_game.move(item, player:getPosition())
- --end
- end
- --if rewardbag has no items in it then
- if container:getItemsCount() < 1 then
- --for every container id open do
- for containerId, container in pairs(g_game.getContainers()) do
- --close each container found
- g_game.close(container)
- end
- --reopen reward chest and restart the loop
- for i, tile in ipairs(g_map.getTiles(posz())) do
- for u,item in ipairs(tile:getItems()) do
- if (item and item:getId() == rewardChest) then
- g_game.use(item)
- end
- end
- end
- end
- end
- end
- end
- end
- until(rewardBagCount > rewardBagTotal)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment