- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
static void npcMove(string npcid, string posX, string posZ, string posY, int localsid)
{
byte[] opcode = { 0x4d, 0x00, 0x16, 0x23, 0x00 };
byte[] npcid_in_bytes = new byte[4];
npcid_in_bytes = Enumerable.Range(0, npcid.Length).Where(x => x % 2 == 0).Select(x => Convert.ToByte(npcid.Substring(x, 2), 16)).ToArray();
Array.Reverse(npcid_in_bytes);
byte[] posX_in_bytes = PackFloatStringArrayOfBytes(posX);
byte[] posZ_in_bytes = PackFloatStringArrayOfBytes(posZ);
byte[] posY_in_bytes = PackFloatStringArrayOfBytes(posY);
byte[] unknown = { 0x00, 0x0f, 0x5c, 0x01, 0x01 };
byte[] roleid_in_bytes = packint(16);
byte[] localdsid_in_bytes = packint(localsid);
byte[] buffer = opcode.Concat<byte>(npcid_in_bytes)
.Concat<byte>(posX_in_bytes).Concat<byte>(posZ_in_bytes).Concat<byte>(posY_in_bytes)
.Concat<byte>(unknown).Concat<byte>(roleid_in_bytes).Concat<byte>(localdsid_in_bytes).ToArray<byte>();
buffer[1] = Convert.ToByte(buffer.Length - 2);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(localhost, GProviderPort);
socket.Send(buffer);
socket.Close();
}