Juntar Itens

Descrição

Juntar itens iguais da bag

Autor:

                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
macro(1000, "Juntar itens", function() local containers = g_game.getContainers() local toStack = {} for index, container in pairs(containers) do if not container.lootContainer then -- ignore monster containers for i, item in ipairs(container:getItems()) do if item:isStackable() and item:getCount() < 100 then local stackWith = toStack[item:getId()] if stackWith then g_game.move(item, stackWith[1], math.min(stackWith[2], item:getCount())) return end toStack[item:getId()] = {container:getSlotPosition(i - 1), 100 - item:getCount()} end end end end end)