avatar
Untitled

Guest 31 3rd Dec, 2019

                                           
                         function __Backpack:Open(use_item, get_container, bp_name)
        use_item()

        local timer = os.clock()
        local end_time = timer + 1
        local container = get_container()

        while (container.Name == nil or container:Name():lower() ~= bp_name) do
            if (os.clock() > end_time) then
                print(bp_name .. ' timeout !')
                break
            end
            if (os.clock() > timer + 0.25) then
                use_item()
                timer = os.clock()
                print(bp_name .. ' was not used !')
            end
            sleep(50)
            container = get_container()
        end

        container:Minimize()

        return container
    end

    function __Backpack:OpenAll()
        local main = self:Open(function() Self.UseItemFromEquipment('backpack') end, function() return Container.GetFirst() end, CONTAINER_GOLD)
        local inside_main = {}

        for k, v in main:iItems() do
            local slot = k
            local item = v

            local name = Item.GetName(item.id):lower()
            if name:find('backpack') then
                inside_main[name] = function() self:Open(function() main:UseItem(slot) end, function() return Container.GetLast() end, name) end
            end
        end

        inside_main[CONTAINER_ULTIMATE_HEALTH_POTION]()
        inside_main[CONTAINER_GREAT_HEALTH_POTION]()
        inside_main[CONTAINER_MANA_POTION]()
        inside_main[CONTAINER_FOOD]()
        inside_main[CONTAINER_VALUABLES]()
        inside_main[CONTAINER_ITEMS]()
        inside_main[CONTAINER_STORAGE]()
    end
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes