d3v1l401 / Bark-and-Barker

A Dark & Darker backend server emulator written in C#
GNU General Public License v3.0
2 stars 0 forks source link

Multi-response packets, NOT support #24

Closed d3v1l401 closed 1 year ago

d3v1l401 commented 1 year ago

Some packets requests (REQ) or responses (RES) will trigger multiple notifications (NOT). Previously, we were expecting 1 REQ -> 1 RES while this time we have 1 REQ -> 1 RES + 1 NOT or 1 RES -> multiple NOT.

This modification of the PacketManager allows to map expected NOTs based on the packet REQ or RES being processed in Handle; additionally, Handle now returns a List of buffers to be sent, the server will iterate trough this list and send each packet buffer to the client.

Not having an entry in m_notificationTriggers will result in following the previous 1 -> 1 flow.

Example:

In PT5 the AccountLoginReq expects 2 packets in return from the server: AccountLoginRes and SS2C_SERVICE_POLICY_NOT. By feeding into m_notificationTriggers the trigger packet AccountLoginReq the server will process AccountLoginRes and then SS2C_SERVICE_POLICY_NOT, reverse its send order and send them.