O fórum teve que ser recriado do zero, usuários do fórum antigo precisam se cadastrar novamente e caso você seja usuário vip se identifique perante a um administrador que o status vip será reatribuído..

Welcome to L2JDream Project

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Zeit

Fix temporário do Geodata (caida no buraco).

Todo mundo tem o mesmo problema com geodata: 

Com esta solução, o personagem retorna ao ponto anterior.

Pack: com.dream.game.network.clientpackets.ValidatePosition;

Change for this:
 

package com.dream.game.network.clientpackets;

import org.apache.log4j.Logger;

import com.dream.Config;
import com.dream.game.geodata.GeoEngine;
import com.dream.game.model.actor.instance.L2PcInstance;
import com.dream.game.network.serverpackets.MoveToLocation;
import com.dream.game.network.serverpackets.PartyMemberPosition;
import com.dream.game.network.serverpackets.ValidateLocation;
import com.dream.game.network.serverpackets.ValidateLocationInVehicle;
import com.dream.game.util.Broadcast;

public class ValidatePosition extends L2GameClientPacket
{
	private static Logger LOGGER = Logger.getLogger(ValidatePosition.class);
	private int _x, _y, _z, _heading;
	@SuppressWarnings("unused")
	private int _data;

	@Override
	protected void readImpl()
	{
		_x = readD();
		_y = readD();
		_z = readD();
		_heading = readD();
		_data = readD();
	}

	@Override
	protected void runImpl()
	{
		L2PcInstance activeChar = getClient().getActiveChar();
		if (activeChar == null || activeChar.isTeleporting())
			return;
		activeChar.checkSummon();
		int realX = activeChar.getX();
		int realY = activeChar.getY();
		int realZ = activeChar.getZ();

		if (_x == 0 && _y == 0)
			if (realX != 0)
				return;

		activeChar.setHeading(_heading);
		double dx = _x - realX;
		double dy = _y - realY;
		double dz = _z - realZ;
		
		int finalZ = _z;
		if (Math.abs(dz) <= 200)
		{
			finalZ = realZ;
		}
		
		double diffSq = dx * dx + dy * dy;
		double speedsq = activeChar.getStat().getMoveSpeed() * activeChar.getStat().getMoveSpeed();
		if (diffSq <= speedsq * 1.5 && dz < 1500)
		{
			activeChar.setLastServerPosition(realX, realY, realZ);
			activeChar.getPosition().setXYZ(_x, _y, _z);
			if (activeChar.getParty() != null)
			{
				activeChar.setLastPartyPosition(_x, _y, _z);
				activeChar.getParty().broadcastToPartyMembers(activeChar, new PartyMemberPosition(activeChar));
			}
			if (activeChar.isInBoat())
			{
				Broadcast.toKnownPlayers(activeChar, new ValidateLocationInVehicle(activeChar));
			}
			else
			{
				Broadcast.toKnownPlayers(activeChar, new ValidateLocation(activeChar));
			}
		}
		// COORD Client<-->Server synchronization
		switch (Config.COORD_SYNCHRONIZE)
		{
		
			case 1:
			{ // full synchronization Client --> Server
				// only * using this option it is difficult
				// for players to bypass obstacles
				
				if (!activeChar.isMoving() || !activeChar.validateMovementHeading(_heading)) // Heading changed on client = possible obstacle
				{
					// character is not moving, take coordinates from client
					if (diffSq < 2500)
					{ // 50*50 - attack won't work fluently if even small differences are corrected
						activeChar.getPosition().setXYZ(realX, realY, finalZ);
						
					}
					else
					{
						activeChar.getPosition().setXYZ(_x, _y, finalZ);
					}
				}
				else
				{
					activeChar.getPosition().setXYZ(realX, realY, finalZ);
					
				}
				
				activeChar.setHeading(_heading);
				
			}
				break;
			case 2:
			{ // full synchronization Server --> Client (bounces for validation)
			
				if (Config.GEODATAS > 0 && (diffSq > 250000 || Math.abs(dz) > 200))
				{
					if (Math.abs(dz) > 200)
					{
						
						if (Math.abs(finalZ - activeChar.getClientZ()) < 800)
						{
							activeChar.getPosition().setXYZ(realX, realY, finalZ);
						}
						
					}
					else
					{
						if (!activeChar.isMoving())
						{
							
							if (activeChar.isInBoat())
								sendPacket(new ValidateLocationInVehicle(activeChar));
							else
								sendPacket(new ValidateLocation(activeChar));
							
						}
						else if (diffSq > activeChar.getStat().getMoveSpeed())
							activeChar.broadcastPacket(new MoveToLocation(activeChar));
						
						finalZ = activeChar.getPosition().getZ();
					}
					
				}
				
			}
				break;
			case -1:
			{ // just (client-->server) Z coordination
			
				if (Math.abs(dz) > 200)
				{
					
					if (Math.abs(_z - activeChar.getClientZ()) < 800)
						activeChar.getPosition().setXYZ(realX, realY, finalZ);
					
				}
				else
					finalZ = realZ;
				
			}
				break;
			default:
			case 0:
			{ // no synchronization at all
				// the server has the correct information
				finalZ = realZ;
			}
				break;
		
		}
		
		// EXPERIMENTAL fix when players cross the floor adapted By Zeit
		int deltaZ = activeChar.getZ() - _z;
		if(deltaZ > 1024)
		{
			int zLocation = GeoEngine.getInstance().getHeight(activeChar.getX(), activeChar.getY(), activeChar.getZ());
			activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), zLocation);
			LOGGER.info("Player " + activeChar.getName() + " has fallen more than 1024 units, returned to last position (" + activeChar.getX() + ", " + activeChar.getY() + ", " + zLocation + ")");
			return;
		}
		
		// check water
		if (Config.ALLOW_WATER)
			activeChar.checkWaterState();

	}
	

}

Config.java

	public static String IGNORE_LOG;

	public static boolean FALLDOWNONDEATH;
	+public static int COORD_SYNCHRONIZE;
	public static int DELETE_DAYS;

			LAZY_ITEMS_UPDATE = Boolean.parseBoolean(p.getProperty("LazyItemsUpdate", "false"));
			+COORD_SYNCHRONIZE = Integer.parseInt(p.getProperty("CoordSynchronize", "-1"));
			SERVER_GMONLY = Boolean.parseBoolean(p.getProperty("ServerGMOnly", "false"));

game\config\main.options:


# A type of synchronization between the client and the server location
# -1 - Will synchronize only Z from Client --> Server. Default when no geodata.
#  1 - Synchronization Client --> Server only. Using this option (without geodata) it is more difficult for players to bypass obstacles
#  2 - Intended for geodata (at least when cell-level pathfinding, otherwise can try -1 also)! 
# It is advisable not to change
CoordSynchronize = -1

PcInstance:

	private int clientZ;
	/**
	 * Gets the client z.
	 * @return the client z
	 */
	public final int getClientZ()
	{
		return clientZ;
	}



 

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0