Why would this affect the whole stack not only the (1) moved item? What I am missing?
I want to apply only to this (1) custom attribute onMoveItem so I don't need to change the source to allow stacking all the custom attributed items.
Lua:
local ec = EventCallback
ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
local moveFromItem = ItemType(item:getId())
if moveFromItem:isStackable() then
if toPosition.x == CONTAINER_POSITION then
local moveToItem = self:getSlotItem(toPosition.y)
if not moveToItem and toCylinder:isItem() then
moveToItem = toCylinder:getItem(toPosition.z)
end
if moveToItem then
if item:getId() == moveToItem:getId() then
if moveToItem and moveToItem:getCustomAttribute("Test", "Attribute") then
item:setCustomAttribute("Test", "Attribute")
self:sendTextMessage(MESSAGE_INFO_DESCR, "Custom attribute added.")
item:setAttribute("description", "Worked")
return RETURNVALUE_NOERROR
end
end
end
end
end
return RETURNVALUE_NOERROR
end
ec:register()
I want to apply only to this (1) custom attribute onMoveItem so I don't need to change the source to allow stacking all the custom attributed items.