Well they disabled the keyboard movement functions, so it's all pretty much fixed. The problem was the world collision boxes they were having with the Z axis. When you used the keyboard to move and then stop, your character would skip one step forward and fall through. Same with the loot. It didn't calculate the Z axis where the mob was so when it spawned items, it dropped through. It's something they could never fix, so they just disabled them I guess. :roll:
Now here's something interesting.
Code:
package net.sf.l2j.gameserver.clientpackets;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import net.sf.l2j.gameserver.ClientThread;
import net.sf.l2j.gameserver.Connection;
import net.sf.l2j.gameserver.model.L2MonsterInstance;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2PcInstance;
import net.sf.l2j.gameserver.model.L2World;
/**
* This class ...
*
* @version $Revision: 1.13 $ $Date: 2004/10/05 20:02:47 $
*/
public class ValidatePosition extends ClientBasePacket
{
private static Logger _log = Logger.getLogger(ValidatePosition.class.getName());
private static final String _C__48_VALIDATEPOSITION = "[C] 48 ValidatePosition";
/**
* packet type id 0x48
* format: cddddd
* @param decrypt
*/
public ValidatePosition(byte[] decrypt, ClientThread client) throws IOException
{
super(decrypt);
int x = readD();
int y = readD();
int z = readD();
int heading = readD();
int data = readD();
L2PcInstance activeChar = client.getActiveChar();
if (activeChar != null)
{
Connection con = client.getConnection();
int realX = activeChar.getX();
int realY = activeChar.getY();
int realZ = activeChar.getZ();
int realHeading = activeChar.getHeading();
//TODO we have to trust the client on the z-coord right now, so just copy the value we got back
activeChar.setZ(z);
// _log.fine("client pos: "+ x + " "+y+ " "+z +" head "+heading);
// _log.fine("server pos: "+ realX + " "+realY+ " "+realZ +" head "+realHeading);
// check for objects that are now out of range
activeChar.updateKnownCounter += 1;
if (activeChar.updateKnownCounter >3)
{
int delete = 0;
List known = activeChar.getKnownObjects();
ArrayList toBeDeleted = new ArrayList();
for (int i = 0; i < known.size(); i++)
{
L2Object obj = (L2Object) known.get(i);
if (distance(activeChar, obj) > 4000*4000)
{
toBeDeleted.add(obj);
delete++;
}
}
if (delete >0)
{
for (int i = 0; i < toBeDeleted.size(); i++)
{
activeChar.removeKnownObject((L2Object) toBeDeleted.get(i));
if (toBeDeleted.get(i) instanceof L2MonsterInstance)
{
((L2MonsterInstance)toBeDeleted.get(i)).removeKnownObject(activeChar);
}
else
{
((L2Object)toBeDeleted.get(i)).removeKnownObject(activeChar);
}
}
_log.fine("deleted " +delete+" objects");
}
// check for new objects that are now in range
int newObjects = 0;
L2Object[] visible = L2World.getInstance().getVisibleObjects(activeChar, 3000);
for (int i = 0; i < visible.length; i++)
{
if (! activeChar.knownsObject(visible[i]))
{
activeChar.addKnownObject(visible[i]);
visible[i].addKnownObject(activeChar);
newObjects++;
}
}
if (newObjects >0)
{
_log.fine("added " + newObjects + " new objects");
}
activeChar.updateKnownCounter = 0;
}
}
}
private long distance(L2Object a, L2Object b)
{
long dX = a.getX() - b.getX();
long dY = a.getY() - b.getY();
return ( dX*dX + dY*dY );
}
/* (non-Javadoc)
* @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
*/
public String getType()
{
return _C__48_VALIDATEPOSITION;
}
}
I know java sucks, but maybe we can use L2J's coding to our advantage, LOL. Here's the thing. Maybe we can use the code looking at the geodata files and strip it down and use L2J's coordinates code to go back and forth from the client and the server? It sounds simple, but maybe it's doable? We could use the code the guy made for the L2 C# and see where he changed it and maybe apply them. I think it would be more functional and less of a hassle than stripping down the geodata files. I can't make any friggin sense from those files, lol.
I'll dig more info up and see if I can find something.
[highlight=red:d78ab1de78]EDIT[/highlight:d78ab1de78] Whoa... I found some stuff.
Here's what the guy put in the C# server code for ValidatePosition. As you can see, it's 100x better than the java code, using real mathematical equations.
Code:
using System;
using net.sf.l2cs.logging;
using net.sf.l2cs.gameserver.l2class;
namespace net.sf.l2cs.gameserver.clientpackets
{
/// <summary>
/// Summary description for ValidatePosition.
/// </summary>
public class ValidatePosition:ClientBasePacket
{
private const string _C__48_VALIDATEPOSITION = "[C] 48 ValidatePosition";
private int[][] testarea = new int[][]
{
new int[]{-72791,257365},
new int[]{-72099,256792},
new int[]{-72256,256529},
new int[]{-73011,257148}
};
public ValidatePosition(byte[] decrypt, ClientThread client):base(decrypt)
{
int x = ReadD();
int y = ReadD();
int z = ReadD();
client.ActiveChar.X = x;
client.ActiveChar.Y = y;
client.ActiveChar.Z = z;
}
/// <summary>
/// Reference from http://ouray.cudenver.edu/~na0alber/computational_geometry/Project.htm
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="area"></param>
/// <returns></returns>
public bool CheckInArea(int x, int y, int[][] area)
{
int i=0, j=0;
double angle = 0.0;
double cross_product = 0.0;
double magnitude1, magnitude2;
double temp0x, temp0y;
double temp1x, temp1y;
for(i = 0; i < area.Length; i++)
{
j++;
if (j==area.Length) j = 0;
// the following will make equations more readable below
temp0x = area[i][0] - x;
temp0y = area[i][1] - y;
temp1x = area[j][0] - x;
temp1y = area[j][1] - y;
// check to see if test point is same as vertex
if((temp0x == 0 && temp0y == 0) || (temp1x == 0 && temp1y == 0))return true;
// calculate the dot product and magnitudes for equation
cross_product = (temp0x * temp1x) + (temp0y * temp1y);
magnitude1 = Math.Sqrt(Math.Pow(temp0x,2) + Math.Pow(temp0y,2));
magnitude2 = Math.Sqrt(Math.Pow(temp1x,2) + Math.Pow(temp1y,2));
// check to see if turning left or right
if (((temp0x * temp1y) - (temp1x * temp0y)) > 0.0 )
{
angle += Math.Acos((double)cross_product/(magnitude1*magnitude2));
}
else
{
angle -= Math.Acos((double)cross_product/(magnitude1*magnitude2));
}
}
angle /= 2*Math.PI;
angle = Math.Abs(angle);
if (angle > 0.0001) // angle should be close to zero if point outside
{
return true;
}
else
{
return false;
}
}
public override string GetType()
{
return _C__48_VALIDATEPOSITION;
}
}
}
As you know, he converted the L2J stuff to C#. Now if you look at this code, you'll notice this website, it starts to make a bit more sense. He used this equation.
http://ouray.cudenver.edu/~na0alber/...ry/Project.htm
Now is there any way we can disassemble the server.exe or perhaps compare the two? I have no clue about VS or how to use it... yet.

Can someone maybe check out the older post I made in the General section of the modders forum so they can maybe let me know if I'm talking out of my ass? LOL. :shock: