File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ public class Connection : Communication, IDisposable
6060 private bool _isSendingToServer = false ;
6161 private bool _isStarted ;
6262
63+ public delegate bool ReceivedMessageEventHandler ( byte [ ] data ) ;
64+
65+ public event ReceivedMessageEventHandler OnReceivedClientMessage ;
66+ public event ReceivedMessageEventHandler OnReceivedServerMessage ;
67+
6368 /// <summary>
6469 /// Initializes a new instance of the <see cref="Connection"/> class that acts as a proxy
6570 /// between the Tibia client and the game server.
@@ -704,6 +709,7 @@ private void BeginReceiveClientCallback(IAsyncResult ar)
704709 else
705710 {
706711 _clientInMessage . PrepareToParse ( _xteaKey ) ;
712+ OnReceivedClientMessage ? . Invoke ( _clientInMessage . GetData ( ) ) ;
707713
708714 if ( _isPacketParsingEnabled )
709715 {
@@ -777,6 +783,7 @@ private void BeginReceiveServerCallback(IAsyncResult ar)
777783 if ( protocol == 1 )
778784 {
779785 _serverInMessage . PrepareToParse ( _xteaKey , _zStream ) ;
786+ OnReceivedServerMessage ? . Invoke ( _serverInMessage . GetData ( ) ) ;
780787
781788 if ( _isPacketParsingEnabled )
782789 {
You can’t perform that action at this time.
0 commit comments