local restricted = {
[Position(2034, 1023, 7)] = {
2007
},
[Position(2034, 1025, 7)] = {
3085
}
}
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
for position, restrictedIds in pairs(restricted) do
if position == fromPosition and isInArray(restrictedIds, item:getId()) then
return false
end
end
if toPosition.x ~= CONTAINER_POSITION then
return true
end
if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then
local itemType, moveItem = ItemType(item:getId())
if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then
moveItem = self:getSlotItem(CONST_SLOT_RIGHT)
elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then
moveItem = self:getSlotItem(CONST_SLOT_LEFT)
if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then
return true
end
end
if moveItem then
local parent = item:getParent()
if parent:isContainer() and parent:getSize() == parent:getCapacity() then
self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
return false
else
return moveItem:moveTo(parent)
end
end
end
return true
end