Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function depositItems(...)
- bot(false) -- turn off walker/looter/targeter
- local pos = directionPos(Self.Position(), Self.LookDirection()) -- get position of where we're looking
- Self.UseItemFromGround(pos.x, pos.y, pos.z) -- open locker
- wait(1500)
- local locker = Container.GetByName("Locker")
- print("DEBUG: started")
- if(locker:isOpen()) then -- did we open locker?
- print("DEBUG: locker open")
- locker:UseItem(0) -- open depot
- wait(1500)
- local depot = Container.GetByName("Depot Chest")
- if(depot:isOpen()) then -- did we open depot?
- print("DEBUG: depot open")
- if(not tonumber(arg[1])) then
- print("DEBUG: using advanced method")
- for backpack, data in pairs(arg[1]) do -- loop through loot backpacks
- local bp = Container.GetByName(backpack)
- print("DEBUG: checking if " .. backpack.. " is open")
- if (bp:isOpen()) then -- loot backpack has to be open already
- print("DEBUG: " .. backpack.. " is open")
- local offset = 0
- for spot = 0, bp:ItemCount() do -- loop through all the items in loot backpack
- local item = bp:GetItemData(spot - offset)
- print("DEBUG: found item " .. item.id.. " in backpack")
- if (isInArray(data.items, item.id)) then -- the item is in the deposit list
- print("DEBUG: the item is in list, trying to move")
- bp:MoveItemToContainer(spot - offset, depot:Index(), data.depotSlot)
- offset = offset + 1 -- we took an item out, the ones afterwards will shift back one
- wait(600, 1500)
- end
- end
- end
- end
- else
- print("DEBUG: using simple method, no debugging for this")
- local bp = Container.GetFirst()
- while (bp:isOpen()) do
- local name = bp:Name()
- if(name ~= "Locker") and (name ~= "Depot Chest") then
- local offset = 0
- for spot = 0, bp:ItemCount() do -- loop through all the items in loot backpack
- local item = bp:GetItemData(spot - offset)
- if (isInArray(arg, item.id)) then -- the item is in the deposit list
- bp:MoveItemToContainer(spot - offset, depot:Index(), 0)
- offset = offset + 1 -- we took an item out, the ones afterwards will shift back one
- wait(600, 1500)
- end
- end
- end
- bp = bp:GetNext() -- next backpack
- end
- end
- end
- end
- bot(true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement