Advertisement
martintokio

Untitled

Jul 18th, 2022
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. mainBP = Container.New(0)
  2. lootBP = Container.New(1)
  3.  
  4. Module.New('glooth bags', function(mod)
  5. local DROP_ITEMS = {"glooth spear", "glooth sandwich", "bowl of glooth soup", "glooth steak"}
  6. local KEEP_ITEMS = {"glooth club", "glooth amulet", "glooth blade", "glooth axe", "control unit", "glooth backpack"}
  7. local bag = Item.GetID("glooth bag")
  8.  
  9. local pos = Self.Position()
  10.  
  11. if (#Self.GetTargets(8) == 0 and mainBP:isOpen()) then
  12.  
  13. if (Self.ItemCount(bag)) then
  14. Self.UseItem(bag)
  15. end
  16.  
  17. for spot, item in mainBP:iItems() do
  18. if table.find(DROP_ITEMS, Item.GetName(item.id)) then
  19. mainBP:MoveItemToGround(spot, pos.x, pos.y, pos.z)
  20. elseif table.find(KEEP_ITEMS, Item.GetName(item.id)) then
  21. local lastIndexInlootBP = lootBP:ItemCapacity()-1
  22. local lastItemInlootBP = lootBP:GetItemData(lastIndexInlootBP)
  23. if (lootBP:isFull() and Item.isContainer(lastItemInlootBP)) then
  24. lootBP:UseItem(lastIndexInlootBP)
  25. else
  26. mainBP:MoveItemToContainer(spot, lootBP:Index(), lootBP:ItemCapacity()-1)
  27. end
  28. end
  29. end
  30. end
  31. mod:Delay(100)
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement