Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mainBP = Container.New(0)
- lootBP = Container.New(1)
- Module.New('glooth bags', function(mod)
- local DROP_ITEMS = {"glooth spear", "glooth sandwich", "bowl of glooth soup", "glooth steak"}
- local KEEP_ITEMS = {"glooth club", "glooth amulet", "glooth blade", "glooth axe", "control unit", "glooth backpack"}
- local bag = Item.GetID("glooth bag")
- local pos = Self.Position()
- if (#Self.GetTargets(8) == 0 and mainBP:isOpen()) then
- if (Self.ItemCount(bag)) then
- Self.UseItem(bag)
- end
- for spot, item in mainBP:iItems() do
- if table.find(DROP_ITEMS, Item.GetName(item.id)) then
- mainBP:MoveItemToGround(spot, pos.x, pos.y, pos.z)
- elseif table.find(KEEP_ITEMS, Item.GetName(item.id)) then
- local lastIndexInlootBP = lootBP:ItemCapacity()-1
- local lastItemInlootBP = lootBP:GetItemData(lastIndexInlootBP)
- if (lootBP:isFull() and Item.isContainer(lastItemInlootBP)) then
- lootBP:UseItem(lastIndexInlootBP)
- else
- mainBP:MoveItemToContainer(spot, lootBP:Index(), lootBP:ItemCapacity()-1)
- end
- end
- end
- end
- mod:Delay(100)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement