Page 1 of 1

New, enchanced 2D clients (about network protocol changes)

Posted: Sun Jan 20, 2008 5:20 am
by Rogdush
Ive began to investigate newer clients network changes, and it seems Ive got them all, just wanna to share, maybe someone will use it, or devs will have lil work with this info.

I had to change 6 packets to make it work.
0x3C - ContainerContent - add new grid location byte before parent serial.
0x25 - AddContainerItem - the same, grid location byte
0x08 - DropItem - grid location byte again, before container serial
0x77, 0x78, 0x20 - this one was odd, POL sends status/mobile flag equals to 0x01 when player is in warmode, where it should send 0x40. Older clients dont mind 0x01 value apparenty, but newer dont accept it as warmode flag and additionally freezes character when 0x01 bit is send in any of those packets in status flag.

There is one more problem with 6.0.5.0 client and its not fixable with packet hooks.
First message that client sends was 4 byte seed, now it sends normal packet with 0xEF id, 21 static length, containing seed at GetInt32(1) and client version number coded into 16 last bytes, 4 bytes on each version number.
It is send on first login only, after server select client sends normal 4 byte seed as usual. Seems nice, isnt it ? POL can get clientVersion before character select.

Packet 0xEF build:
BYTE[1] cmd
BYTE[4] seed
BYTE[4] client major version
BYTE[4] client minor version
BYTE[4] client revision version
BYTE[4] client prototype version

Im attaching packet hooks for all network changes Ive noticed in newer clients, 6.0.1.10 and couple above will work fine, but for 6.0.5.0 support we need new pol with ability of handling 0xEF packet :)

Ops, I cant attach files here, Ill post it in code segments.

uopacket.cfg:

Code: Select all

Packet 0x3C
{
  Length           variable
  SendFunction     update:ContainerContent
}

Packet 0x25
{
  Length           21
  SendFunction     update:AddContainerItem
}

Packet 0x08
{
  Length           15
  ReceiveFunction  update:DropItem
}

Packet 0x77
{
  Length           0x11
  SendFunction     update:UpdatePlayer
}

Packet 0x78
{
  Length           variable
  SendFunction     update:UpdateEquipped
}

Packet 0x20
{
  Length           0x13
  SendFunction     update:DrawPlayer
}
update.src:

Code: Select all

//--------------------------------------------------------------------------------

use uo;

//--------------------------------------------------------------------------------

program UOKRPackets()
  
  print("[0x3C]: UO:KR Fix: ContainerContent");
  print("[0x25]: UO:KR Fix: AddContainerItem");
  print("[0x08]: UO:KR Fix: UpdatePlayer");
  print("[0x77]: UO:KR Fix: UpdateEquipped");
  print("[0x78]: UO:KR Fix: DropItem");
  print("[0x20]: UO:KR Fix: DrawPlayer");
  
  return 1;

endprogram

//--------------------------------------------------------------------------------

const ITEMS_OFFSET      := 5;
const BLOCK_LEN         := 19;
const KR_BLOCK_LEN      := 20;

//--------------------------------------------------------------------------------

exported function ContainerContent(who, byref newPacket)

  var Packet := newPacket;
  var Items := array;
  var Count := Packet.GetInt16(3);
  var i, Item, oOffset, nOffset;

  for(i:=0; i<Count; i+=1)
    Item := struct;
    oOffset := ITEMS_OFFSET+i*BLOCK_LEN;
    nOffset := ITEMS_OFFSET+i*KR_BLOCK_LEN;

    Item.+serial := Packet.GetInt32(oOffset);
    Item.+model  := Packet.GetInt16(oOffset+4);
    Item.+amount := Packet.GetInt16(oOffset+7);
    Item.+x      := Packet.GetInt16(oOffset+9);
    Item.+y      := Packet.GetInt16(oOffset+11);
    Item.+parent := Packet.GetInt32(oOffset+13);
    Item.+color  := Packet.GetInt16(oOffset+17);

    newPacket.SetInt32(nOffset, Item.serial);
    newPacket.SetInt16(nOffset+4, Item.model);
    newPacket.SetInt8(nOffset+6, 0);
    newPacket.SetInt16(nOffset+7, Item.amount);
    newPacket.SetInt16(nOffset+9, Item.x);
    newPacket.SetInt16(nOffset+11, Item.y);
    newPacket.SetInt8(nOffset+13, 0);
    newPacket.SetInt32(nOffset+14, Item.parent);
    newPacket.SetInt16(nOffset+18, Item.color);
    
  endfor

  return 0;

endfunction

//--------------------------------------------------------------------------------

exported function AddContainerItem(who, byref Packet)

  var parent := Packet.GetInt32(14);
  var color  := Packet.GetInt16(18);

  Packet.SetInt8(14, 0);
  Packet.SetInt32(15, parent);
  Packet.SetInt16(19, color);

  return 0;

endfunction

//--------------------------------------------------------------------------------

exported function DropItem(who, byref Packet)

  Packet.SetInt32(10, Packet.GetInt32(11));
  Packet.SetInt8(14, 0);
  
  return 0;

endfunction

//--------------------------------------------------------------------------------

function VerifyStatus(byref Status)

  if(Status & 0x01)
    Status := Status - 0x01;
    Status := Status | 0x40;
  endif

endfunction

//--------------------------------------------------------------------------------

exported function UpdatePlayer(who, byref Packet)

  var Status := Packet.GetInt8(15);
  VerifyStatus(Status);
  Packet.SetInt8(15, Status);

  return 0;

endfunction

//--------------------------------------------------------------------------------

exported function UpdateEquipped(who, byref Packet)

  var Status := Packet.GetInt8(17);
  VerifyStatus(Status);
  Packet.SetInt8(17, Status);

  return 0;

endfunction

//--------------------------------------------------------------------------------

exported function DrawPlayer(who, byref Packet)

  var Status := Packet.GetInt8(10);
  VerifyStatus(Status);
  Packet.SetInt8(10, Status);

  return 0;

endfunction

//--------------------------------------------------------------------------------

Posted: Sun Jan 20, 2008 5:38 pm
by qrak
awesome, post of the month ;)

Posted: Mon Jan 21, 2008 7:41 am
by coltain
outstanding, many thx

Posted: Sun Mar 30, 2008 10:49 am
by phao
talking about those 'new packets'.
where can I find a list of those new packets?

Re: New, enchanced 2D clients (about network protocol changes)

Posted: Tue Sep 30, 2008 10:12 am
by BELL

Code: Select all

E:\BELL\fw>scripts\ecompile
EScript Compiler v1.05
Copyright (C) 1994-2007 Eric N. Swanson

Compiling: pkg/update/update.src
Token '=' cannot follow token '+'
Error compiling statement at E:\BELL\fw\pkg\update\update.src, Line 35
Error in function 'ContainerContent', File: E:\BELL\fw\pkg\update\update.src, Li
ne 35

Error in function 'ContainerContent'.
File: E:\BELL\fw\pkg\update\update.src, Line 35
Execution aborted due to: Error compiling file
pol97

Re: New, enchanced 2D clients (about network protocol changes)

Posted: Tue Sep 30, 2008 10:22 am
by BELL
sorry :)
for(i:=0; i<Count; i+=1) ---> for(i:=0; i<Count; i:=i+1)

Re: New, enchanced 2D clients (about network protocol changes)

Posted: Wed Oct 01, 2008 4:13 pm
by Pierce
@BELL:
What are you trying to say?

Packets of the newer clients including UOKR at least need a Pol 97 server
and that server supports +=. No need to go back to i := i+1, cause you
need a Pol97 server to support UOKR and newer clients.

Even if not all support exists yet, you need Pol 97 for this packets.

If you run an older core version it is perhaps better to give your players an
older client to download instead of trying to convert 97 scripts to older core versions :D

Re: New, enchanced 2D clients (about network protocol changes)

Posted: Wed Oct 01, 2008 11:26 pm
by BELL
Pierce wrote:@BELL:
What are you trying to say?

Packets of the newer clients including UOKR at least need a Pol 97 server
and that server supports +=. No need to go back to i := i+1, cause you
need a Pol97 server to support UOKR and newer clients.

Even if not all support exists yet, you need Pol 97 for this packets.

If you run an older core version it is perhaps better to give your players an
older client to download instead of trying to convert 97 scripts to older core versions :D
im trying to using KR ))))
you have icq? i need help about this ((
i download UO:KR 20 minutes older ))))
----
POL 97 last download now, tnx

Re: New, enchanced 2D clients (about network protocol changes)

Posted: Thu Oct 02, 2008 2:43 am
by Pierce
i download UO:KR 20 minutes older
What KR client version are you using?
If it is 2.48.0.3 or higher you won't be able to connect to Pol.
You need a KR version before that, because there was a
change in the login process.
The same for the 2D client 6.0.5.0 or higher like Rogdush said
above.

Or take a look there:
http://forums.polserver.com/viewtopic.php?f=4&t=1997