Advertisement
ppgab

Untitled

Aug 1st, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. -- ADD ITEMS TO LOOT LIST BELOW, BE SURE TO SEPARATE EACH ITEM WITH A COMMA
  2. -- VALID INPUTS ARE {CONTAINER INDEX,ID,ID,ID}, ETC
  3. -- REMEMBER 0 IS FIRST CONTAINER INDEX
  4.  
  5. local itemList = { {0,3031,3035}, {1, 123, 321}}
  6.  
  7. --[[ DO NOT EDIT BELOW ]]--
  8.  
  9. function getOpenBackpacks()
  10.     local count = 0
  11.     local bp = Container:GetFirst()
  12.     while bp:isOpen() do
  13.         count = count + 1
  14.         bp = bp:GetNext()
  15.     end
  16.     return count
  17. end
  18.  
  19. function table.fastfind(value, table)
  20.     local data = table
  21.     for i = 1, #data do
  22.         if value == data[i] then
  23.             return value
  24.         end
  25.     end
  26.     return false
  27. end
  28.  
  29. function getSpot(index)
  30.     local cont = Container(index)
  31.     for i = 0, cont:ItemCount()-1 do
  32.         local itemid = cont:GetItemData(i)
  33.         if not Item.isContainer(itemid) then
  34.             spot = i
  35.             return spot
  36.         end
  37.     end
  38.     return 0
  39. end
  40.  
  41. function DoIt()
  42. local ID = Self.TargetID()
  43. if ID and ID~=0 then
  44.     Target = Creature(ID)
  45.         local pos
  46.         while Target:isAlive() do
  47.             pos = Target:Position()
  48.         end
  49.     if pos then
  50.         Walker.Stop()
  51.         Targeting.Stop()
  52.         local tries = 4
  53.         local bps = getOpenBackpacks()
  54.         while bps == getOpenBackpacks() and tries > 0 do
  55.             wait(700,1000)
  56.             Self.UseItemFromGround(pos.x, pos.y ,pos.z)
  57.             wait(300,500)
  58.             tries = tries-1
  59.         end
  60.         wait(500,700)
  61.         if bps < getOpenBackpacks() then
  62.             local corp = Container.GetLast()
  63.             for i = corp:ItemCount()-1, 0, -1 do
  64.                 local item = corp:GetItemData(i)
  65.                 for j = 1, #itemList do
  66.                     local tbl = itemList[j]
  67.                     local index = tbl[1]
  68.                     local to = Container(index)
  69.                     local continue = true
  70.                     if table.fastfind(item.id, tbl) then
  71.                         if to:isFull() then
  72.                             if Item.isContainer(to:GetItemData(to:ItemCount()-1)) then
  73.                                 to:UseItem(to:ItemCount()-1, true)
  74.                                 wait(450,700)
  75.                             else
  76.                                 continue = false
  77.                             end
  78.                         end
  79.                         if continue then
  80.                             corp:MoveItemToContainer(i, index, getSpot(index), item.count)
  81.                             wait(550,800)
  82.                         end
  83.                     end
  84.                 end
  85.             end
  86.         end
  87.     end
  88.         Targeting.Start()
  89.         Walker.Start()
  90. end
  91. end
  92.  
  93. Module.New("looter", function(mod)
  94.     DoIt()
  95. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement