{
sendPacket(new ValidateLocationInVehicle(activeChar));
}
else
{
activeChar.sendPacket(new ValidateLocation(activeChar));
}
}
}
activeChar.setLastClientPosition(_x, _y, _z);
activeChar.setLastServerPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ());
}
else if (Config.COORD_SYNCHRONIZE == -1)
{
activeChar.setClientX(_x);
activeChar.setClientY(_y);
activeChar.setClientZ(_z);
activeChar.setClientHeading(_heading);
int realX = activeChar.getX();
int realY = activeChar.getY();
int realZ = activeChar.getZ();
double dx = _x - realX;
double dy = _y - realY;
double diffSq = (dx*dx + dy*dy);
if (diffSq < 250000)
activeChar.setXYZ(realX,realY,_z);
int realHeading = activeChar.getHeading();
//activeChar.setHeading(_heading);
//TODO: do we need to validate?
/*double dx = (_x - realX);
double dy = (_y - realY);
double dist = Math.sqrt(dx*dx + dy*dy);
if ((dist < 500)&&(dist > 2)) //check it wasnt teleportation, and char isn't there yet
activeChar.sendPacket(new CharMoveToLocation(activeChar));*/
if (Config.DEBUG) {
_log.fine("client pos: "+ _x + " "+ _y + " "+ _z +" head "+ _heading);
_log.fine("server pos: "+ realX + " "+realY+ " "+realZ +" head "+realHeading);
}
if (Config.ACTIVATE_POSITION_RECORDER && !activeChar.isFlying() && Universe.getInstance().shouldLog(activeChar.getObjectId()))
Universe.getInstance().registerHeight(realX, realY, _z);
if (Config.DEVELOPER)
{
if (diffSq > 1000000) {
if (Config.DEBUG) _log.fine("client/server dist diff "+ (int)Math.sqrt(diffSq));
if (activeChar.isInBoat())
{
sendPacket(new ValidateLocationInVehicle(activeChar));
}
else
{
activeChar.sendPacket(new ValidateLocation(activeChar));
}
}
}
}
if(activeChar.getParty() != null)