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

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 097.
Note: Core 097 is no longer officially supported.

Moderator: POL Developer

Post Reply
Rogdush
New User
Posts: 29
Joined: Fri Feb 10, 2006 8:29 am

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

Post by Rogdush » Sun Jan 20, 2008 5:20 am

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

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

qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm
Location: Poland

Post by qrak » Sun Jan 20, 2008 5:38 pm

awesome, post of the month ;)
Shutdown();

coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am
Location: Poland

Post by coltain » Mon Jan 21, 2008 7:41 am

outstanding, many thx

phao
Grandmaster Poster
Posts: 129
Joined: Fri Aug 31, 2007 2:25 pm
Location: Brazil
Contact:

Post by phao » Sun Mar 30, 2008 10:49 am

talking about those 'new packets'.
where can I find a list of those new packets?
Hello from Brazil :)

BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

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

Post by BELL » Tue Sep 30, 2008 10:12 am

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

BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

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

Post by BELL » Tue Sep 30, 2008 10:22 am

sorry :)
for(i:=0; i<Count; i+=1) ---> for(i:=0; i<Count; i:=i+1)

Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

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

Post by Pierce » Wed Oct 01, 2008 4:13 pm

@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

BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

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

Post by BELL » Wed Oct 01, 2008 11:26 pm

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

Pierce
Forum Regular
Posts: 420
Joined: Thu Feb 02, 2006 8:33 am

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

Post by Pierce » Thu Oct 02, 2008 2:43 am

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

Post Reply