rope for 7.4

This commit is contained in:
ErikasKontenis
2021-04-07 21:37:48 +03:00
parent 9d076f1000
commit bf80fa8919

View File

@@ -8,39 +8,30 @@ local holeSpots = {
595, 607, 609, 610, 615, 1066, 1067, 1080 595, 607, 609, 610, 615, 1066, 1067, 1080
} }
function onUse(player, item, fromPosition, target, toPosition) local pools = {2886, 2887, 2888, 2889, 2890, 2891, 2895, 2896, 2897, 2898, 2899, 2900}
local tile = Tile(toPosition)
if not tile then -- Rope for 7.4 protocol.
return false function onUse(cid, item, frompos, item2, topos)
end local newPos = {x = topos.x, y = topos.y, z = topos.z, stackpos = 0}
local groundItem = getThingfromPos(newPos)
if not tile:getGround() then local blockingItem = getThingfromPos({x = topos.x, y = topos.y, z = topos.z, stackpos = 255})
return false if table.contains(ropeSpots, groundItem.itemid) then
end newPos.y = newPos.y + 1
newPos.z = newPos.z - 1
if table.contains(ropeSpots, tile:getGround():getId()) and tile:getThingCount() <= 1 then if((blockingItem.itemid > 0 and not isInArray(pools, blockingItem.itemid)) or isCreature(blockingItem.uid)) then
player:teleportTo(target:getPosition():moveRel(0, 1, -1)) doPlayerSendCancel(cid, "You cannot use this object.")
return true else
elseif table.contains(holeSpots, tile:getGround():getId()) or target:getId() == 435 then doTeleportThing(cid, newPos)
local tile = Tile(target:getPosition():moveRel(0, 0, 1)) end
if not tile then elseif table.contains(holeSpots, groundItem.itemid) then
return false newPos.y = newPos.y + 1
end local downPos = {x = topos.x, y = topos.y, z = topos.z + 1, stackpos = 255}
local downItem = getThingfromPos(downPos)
local thing = tile:getTopCreature() if(downItem.itemid > 0) then
if not thing then doTeleportThing(downItem.uid, newPos)
thing = tile:getTopVisibleThing() else
end doPlayerSendCancel(cid, "You cannot use this object.")
end
if thing:isCreature() then end
thing:teleportTo(target:getPosition():moveRel(0, 1, 0), false) return true
return true end
end
if thing:isItem() and thing:getType():isMovable() then
thing:moveTo(target:getPosition():moveRel(0, 1, 0))
return true
end
return true
end
return false
end