Hey there,
I've been hella busy lately, some guy asked me about handling messages in client-side like a week ago, I told 'em I'll make a guide and I totally got busy & forgot.
Anyways, lets get into this.

Note: Structures don't really have to be 100% correct, that's just analyzing & guesses.
How To Hook State Process: Since
OnPacketRecv is a virtual function, its a different function with a different address per state process.
The main place where
OnPacketRecv is called should be at:
Code:
00BA8FB1 | FF D0 | call eax | OnPacketRecv
So basically, you can set a breakpoint there in different state processes & get the address of the function.
For example, I want the address of
CPSTitle::OnPacketRecv, so I set a breakpoint on that address above during login section, when the breakpoint hits, get the value of
EAX, thats your function address.
I made an example as for
CPSMission, which handles msgs after selecting your character.

Code:
replaceAddr(0x00DD440C, addr_from_this(&CPSMission::OnPacketRecv));
And that's all.
Note: If you're planning to use
ReadStringA or
ReadStringW functions, you need to ensure you're using VC80 compiler, AKA Visual Studio 2005.
Special thanks to:
florian0