[C#] 7021 Movement Packet

02/17/2017 19:33 Kardil#1
Hey guys, am trying to send movement packet (7021) , it's working good with (+) Cords but (-) Cords isn't.
That's the calculation iam using

Code:
int xPosition = Convert.ToInt32((x % 192) * 10);
            int yPosition = Convert.ToInt32((y % 192) * 10);
            int xSector = Convert.ToInt32((x - xPosition / 10) / 192 + 135);
            int ySector = Convert.ToInt32((y - yPosition / 10) / 192 + 92);
- Also if someone can tell me parsing of B021 would be thankful
02/21/2017 19:16 Kardil#2
push
02/21/2017 21:32 M4n1ak#3
Code:
uint xPos = 0;
uint yPos = 0;

if (X > 0 && Y > 0)
{
	xPos = (uint)((X % 192) * 10);
	yPos = (uint)((Y % 192) * 10);
}
else
{
	if(X < 0 && Y > 0)
	{
		xPos = (uint)((192 + (X % 192)) * 10);
		yPos = (uint)((Y % 192) * 10);
	}
	else
	{
		if (X > 0 && Y < 0)
		{
			xPos = (uint)((X % 192) * 10);
			yPos = (uint)((192 + (Y % 192)) * 10);
		}
	}
}

byte xSector = (byte)((X - (int)(xPos / 10)) / 192 + 135);
byte ySector = (byte)((Y - (int)(yPos / 10)) / 192 + 92);
Credits goes to Zeteris