Don't attempt to stack if the item cannot be stacked.

This commit is contained in:
Andrew Tomaka 2011-06-30 17:19:50 -04:00
parent ab4ea38a13
commit d30d5baafe

View file

@ -16,10 +16,10 @@ function core:StackGems(_,message)
local sourceContainer,sourceSlot,destContainer,destSlot = -1,-1,-1,-1; local sourceContainer,sourceSlot,destContainer,destSlot = -1,-1,-1,-1;
for bag = 0,4 do for bag = 0,4 do
for slot = 1,GetContainerNumSlots(bag) do for slot = 1,GetContainerNumSlots(bag) do
itemId = GetContainerItemID(bag,slot) local itemId = GetContainerItemID(bag,slot)
if(itemId) then if(itemId) then
itemName = GetItemInfo(itemId); local itemName,_,_,_,_,_,_,maxStack = GetItemInfo(itemId);
if(gem == itemName) then if(gem == itemName and maxStack ~= 1) then
local _,count = GetContainerItemInfo(bag,slot); local _,count = GetContainerItemInfo(bag,slot);
if(count == 1 and sourceContainer < 0) then if(count == 1 and sourceContainer < 0) then
sourceContainer = bag; sourceContainer = bag;