Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
1.5 kB
2
Indexable
Never
macro(300, "Reward chest", function()
    local rewardChest = 22807 --19250 --22807
    local rewardBag = 3504 --19250 --3504
    local rewardBagTotal = 0
    local rewardBagCount = 1
    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
            print("We're in the Reward Chest")
            --Set rewardBagTotal = items in rewardChest
            rewardBagTotal = container:getItemsCount()
            for i, item in ipairs(container:getItems()) do
                print("Reward Chest - selecting first slot bag")
                --Open the first slot
                g_game.open(item, container)
                
                newContainer = item:getContainerItem()
                for j, newCContainer in pairs(getContainers()) do
                    if newCContainer:getContainerItem():getId() == lootBp then
                        for _, newCItem in ipairs(newContainer:getItems() do
                            g_game.move(newCItem, newCContainer)
                        end
                    end
                end
                g_game.open(item, container)              
            end
        end
    end
end) 
Leave a Comment