Fix for moving creatures/items far out of reach

Fix to https://github.com/edubart/otclient/issues/1055
This commit is contained in:
4drik 2019-11-20 10:23:39 +01:00 committed by diath
parent 656dff45f1
commit 91a80017b4

View File

@ -20,15 +20,26 @@ function UIItem:onDragLeave(droppedWidget, mousePos)
end end
function UIItem:onDrop(widget, mousePos) function UIItem:onDrop(widget, mousePos)
if not self:canAcceptDrop(widget, mousePos) then return false end
if not self:canAcceptDrop(widget, mousePos) then
return false
end
local item = widget.currentDragThing local item = widget.currentDragThing
if not item:isItem() then return false end if not item:isItem() then
return false
local toPos = self.position end
local itemPos = item:getPosition() local itemPos = item:getPosition()
if itemPos.x == toPos.x and itemPos.y == toPos.y and itemPos.z == toPos.z then return false end local itemTile = item:getTile()
if itemPos.x ~= 65535 and not itemTile then
return false
end
local toPos = self.position
if itemPos.x == toPos.x and itemPos.y == toPos.y and itemPos.z == toPos.z then
return false
end
if item:getCount() > 1 then if item:getCount() > 1 then
modules.game_interface.moveStackableItem(item, toPos) modules.game_interface.moveStackableItem(item, toPos)