Advertisement
ppgab

Untitled

Aug 6th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. function getSpot(to)
  2.         if type(to) == 'number' or type(to) == 'string' then
  3.             cont = Container(to)
  4.         else
  5.             cont = to
  6.         end
  7.         for i = 0 , cont:ItemCapacity()-1 do
  8.                 if (not Item.isContainer(cont:GetItemData(i).id)) then
  9.                         local slot = i
  10.                         return slot
  11.                 end
  12.         end
  13.         return 0
  14.     end
  15. end
  16. -- {{bp,id,id,id},{otherbp,id,id,id}}
  17. local Sorter = {{SupplyBP,AvalancheID,SDID,ManaID}}
  18.  
  19. sorter = Module.New("sorter", function(mod)
  20. for i = 1, #Sorter do
  21.     local data = Sorter[i]
  22.     local cont = Container(data[1])
  23.     if cont:isOpen() then
  24.         local ind = cont:Index()
  25.         bp = Container.GetFirst()
  26.         while bp:isOpen() do
  27.             if bp:Index() ~= ind then
  28.                 for j = bp:ItemCount()-1, 0, -1 do
  29.                     local item = bp:GetItemData(j)
  30.                     if table.contains(data,item.id) then
  31.                         bp:MoveItemToContainer(j,ind,getSpot(ind),item.count)
  32.                         wait(400,700)
  33.                     end
  34.                 end
  35.             end
  36.             bp = bp:GetNext()
  37.         end
  38.     end
  39. end
  40. end,false)
  41.  
  42. if Sorter and Sorter ~= {} then
  43.     sorte
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement