PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
New, enchanced 2D clients (about network protocol changes)

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion 097
Display posts from previous:   

Author Message
Rogdush



Joined: 10 Feb 2006
Posts: 21

PostPosted: Sun Jan 20, 2008 9:20 am    Post subject: New, enchanced 2D clients (about network protocol changes) Reply with quote

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 Smile

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

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

Author Message
qrak



Joined: 05 Feb 2006
Posts: 160
Location: Poland

PostPosted: Sun Jan 20, 2008 9:38 pm    Post subject: Reply with quote

awesome, post of the month Wink

Author Message
coltain



Joined: 20 Mar 2007
Posts: 96
Location: Poland

PostPosted: Mon Jan 21, 2008 11:41 am    Post subject: Reply with quote

outstanding, many thx

Author Message
phao



Joined: 31 Aug 2007
Posts: 34

PostPosted: Sun Mar 30, 2008 2:49 pm    Post subject: Reply with quote

talking about those 'new packets'.
where can I find a list of those new packets?

Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion 097 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty