Advertisement
ppgab

Untitled

Jun 12th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. local bbp = Container.GetLast()                                                                        
  2.             for i = bbp:ItemCount()-1 , 0 ,-1  do
  3.                 local continue = true                                                                        
  4.                 if bbp:GetItemData(i).id == 3031 then
  5.                     if Container(1):isFull() then
  6.                         if StillHasContainers(1) then
  7.                         Container(1):UseItem(Container(1):ItemCount()-1,true)
  8.                         else
  9.                         continue = false
  10.                         end
  11.                     end
  12.                     if continue then
  13.                     bossBody:MoveItemToContainer(i, 1, getSpot(1), 100)
  14.                     mod:Delay(600,800)
  15.                     end  
  16.                 continue = true
  17.                 elseif table.contains(itemList, bbp:GetItemData(i).id) then
  18.                     if Container(2):isFull() then
  19.                         if StillHasContainers(2) then
  20.                         Container(2):UseItem(Container(2):ItemCount()-1,true)
  21.                         else
  22.                         continue = false
  23.                         end
  24.                     end
  25.                     if continue then                                                                    
  26.                     bossBody:MoveItemToContainer(i, 2, getSpot(2), 100)
  27.                     mod:Delay(600,800)
  28.                     end      
  29.                 end
  30.  
  31.  
  32. local function getSpot(to)
  33.         local cont = Container(to)
  34.         for i=0, cont:ItemCount()-1 do
  35.             if (not Item.isContainer(cont:GetItemData(i).id)) then
  36.                 local slot = i
  37.                 return slot
  38.             end
  39.         end
  40.         return 0
  41. end
  42.  
  43. local function StillHasContainers(container, returnspot)
  44.         local bp = Container(container)
  45.         for i=bp:ItemCount()-1, 0, -1 do
  46.             if Item.isContainer(bp:GetItemData(i).id) then
  47.                 if (not returnspot) then
  48.                     return true
  49.                 else
  50.                     local spot = i
  51.                     return spot
  52.                 end
  53.             end
  54.         end
  55.         return false
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement