Set last server position when player is restored.

This commit is contained in:
MobiusDev 2018-04-26 03:08:58 +00:00
parent f03fa5db9a
commit 78fd10482f
17 changed files with 75 additions and 9 deletions

View File

@ -6648,7 +6648,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -6655,7 +6655,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -6657,7 +6657,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -6654,7 +6654,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -10128,7 +10128,11 @@ public final class L2PcInstance extends L2Playable
// L2World.getInstance().storeObject(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Retrieve the name and ID of the other characters assigned to this account.
PreparedStatement stmt = con.prepareStatement("SELECT obj_Id, char_name FROM characters WHERE account_name=? AND obj_Id<>?");
@ -15481,6 +15485,11 @@ public final class L2PcInstance extends L2Playable
return (int) Math.sqrt((dx * dx) + (dy * dy) + (dz * dz));
}
public Location getLastServerPosition()
{
return _lastServerPosition;
}
/**
* Sets the last server position.
* @param x the x

View File

@ -20,6 +20,7 @@ import java.nio.BufferUnderflowException;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.datatables.csv.DoorTable;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.position.Location;
import com.l2jmobius.gameserver.network.SystemMessageId;
@ -110,6 +111,14 @@ public class MoveBackwardToLocation extends L2GameClientPacket
return;
}
// Mobius: Check for possible door logout and move over exploit. Also checked at ValidatePosition.
if (DoorTable.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if (_movementMode == 1)
{
activeChar.setCursorKeyMovement(false);

View File

@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.datatables.csv.DoorTable;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
@ -162,6 +163,11 @@ public final class ValidatePosition extends L2GameClientPacket
activeChar.setClientY(_y);
activeChar.setClientZ(_z);
activeChar.setClientHeading(_heading); // No real need to validate heading.
activeChar.setLastServerPosition(realX, realY, realZ);
// Mobius: Check for possible door logout and move over exploit. Also checked at MoveBackwardToLocation.
if (!DoorTable.getInstance().checkIfDoorsBetween(realX, realY, realZ, _x, _y, _z))
{
activeChar.setLastServerPosition(realX, realY, realZ);
}
}
}

View File

@ -6821,7 +6821,11 @@ public final class L2PcInstance extends L2Playable
player.setVitalityPoints(rset.getInt("vitality_points"), true);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -86,6 +86,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -93,6 +94,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceId(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -6620,7 +6620,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}

View File

@ -6620,7 +6620,11 @@ public final class L2PcInstance extends L2Playable
CursedWeaponsManager.getInstance().checkPlayer(player);
// Set the x,y,z position of the L2PcInstance and make it invisible
player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
final int x = rset.getInt("x");
final int y = rset.getInt("y");
final int z = rset.getInt("z");
player.setXYZInvisible(x, y, z);
player.setLastServerPosition(x, y, z);
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));

View File

@ -84,6 +84,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if ((_targetX == _originX) && (_targetY == _originY) && (_targetZ == _originZ))
{
activeChar.sendPacket(new StopMove(activeChar));
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
@ -91,6 +92,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
if (DoorData.getInstance().checkIfDoorsBetween(activeChar.getX(), activeChar.getY(), activeChar.getZ(), _targetX, _targetY, _targetZ, activeChar.getInstanceWorld(), false))
{
activeChar.stopMove(activeChar.getLastServerPosition());
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}