local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
local conditions = {
CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY,
CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN,
CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED
}
local BORDERS = {
[7943] = {x = 0, y = -2, back = SOUTH},
[7944] = {x = -2, y = 0, back = EAST},
[7945] = {x = 0, y = 2, back = NORTH},
[7946] = {x = 2, y = 0, back = WEST},
[7947] = {x = 2, y = 1, back = WEST},
[7948] = {x = -2, y = 1, back = NORTH},
[7949] = {x = 2, y = -1, back = WEST},
[7950] = {x = -2, y = -1, back = EAST},
[7951] = {x = 2, y = 2, back = WEST},
[7952] = {x = -2, y = 2, back = NORTH},
[7953] = {x = 2, y = -2, back = WEST},
[7954] = {x = -2, y = -2, back = SOUTH}
}
function onStepIn(cid, item, position, fromPosition)
if(isPlayer(cid) ~= TRUE) then
return true
end
local border = BORDERS[item.itemid]
if(not border) then
return false
end
local pos, newPos = getCreaturePosition(cid), {}
newPos = pos
newPos.x = pos.x + border.x
newPos.y = pos.y + border.y
if(getCreatureCondition(cid, CONDITION_OUTFIT) == TRUE and getCreatureOutfit(cid).lookType == outfit.lookType) then
doMoveCreature(cid, border.back)
doRemoveCondition(cid, CONDITION_OUTFIT)
else
if(queryTileAddThing(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
return false
end
local tmp = getCreaturePosition(cid)
doTeleportThing(cid, newPos)
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
for i, v in ipairs(conditions) do
if(getCreatureCondition(cid, v) == TRUE) then
doRemoveCondition(cid, v)
end
end
doSetCreatureOutfit(cid, outfit, -1)
end
return TRUE
end