PenUltima Online

It is currently Wed Aug 20, 2008 2:16 pm

All times are UTC - 4 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: New, enchanced 2D clients (about network protocol changes)
PostPosted: Sun Jan 20, 2008 9:20 am 
Offline

Joined: Fri Feb 10, 2006 12:29 pm
Posts: 21
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:
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:
//--------------------------------------------------------------------------------

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

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 20, 2008 9:38 pm 
Offline

Joined: Sun Feb 05, 2006 8:35 pm
Posts: 160
Location: Poland
awesome, post of the month ;)

_________________
Shutdown();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 11:41 am 
Offline

Joined: Tue Mar 20, 2007 11:17 am
Posts: 99
Location: Poland
outstanding, many thx


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 30, 2008 2:49 pm 
Offline

Joined: Fri Aug 31, 2007 6:25 pm
Posts: 42
talking about those 'new packets'.
where can I find a list of those new packets?

_________________
Hello from Brazil :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 4 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl