private static void OnNewNetworkPacket(object sender, NetworkPacketEvent networkPacketEvent)
 {
     // delegate event from network worker, this will be all incoming packets for the game
     if (sender == null)
     {
         return;
     }
     var networkPacket = networkPacketEvent.Packet;
     // networkPacket.Key is unique for each type of packet
     // you will have to implement your own parsing of the newPacket.Message/Buffer after this
     // packets are already decrypted
     switch (networkPacket.Key)
     {
         default:
             break;
     }
 }
        private static void OnNewNetworkPacket(object sender, NetworkPacketEvent networkPacketEvent)
        {
            // delegate event from network worker, this will be all incoming packets for the game
            if (sender == null)
            {
                return;
            }
            var networkPacket = networkPacketEvent.Packet;
            // networkPacket.Key is unique for each type of packet
            // you will have to implement your own parsing of the newPacket.Message/Buffer after this
            // packets are already decrypted

            //BitConverter.ToString(networkPacket.Buffer)

            //LogPublisher.WriteLine("Packet picked up");
            //Logging.Log(LogManager.GetCurrentClassLogger(), debug_output);

                switch (networkPacket.Key)
            {
                case 17563668:
                    //?? market related
                    break;
                case 17039380:
                    //?? market related
                    break;
                case 17367060:
                    //?? market related
                    break;

                case 17104916:
                    LogPublisher.WriteLine("Parsing market packet");
                    if (networkPacket.MessageSize != 1160)
                    {
                        LogPublisher.WriteLine("invalid order list, wrong size. expected 1160, got " + networkPacket.MessageSize);
                        break;
                    }
                    //list of market orders
                    try {
                        MarketParser.ParseOrderList(networkPacket.Buffer);
                    } catch (Exception)
                    {
                        LogPublisher.WriteLine("exception encountered with parsing");
                    }

                    break;
                default:
                    break;
            }
        }
Exemple #3
0
 public virtual void RaiseNewNetworkPacket(NetworkPacket e)
 {
     var networkPacketEvent = new NetworkPacketEvent(this, e);
     var handler = NewNetworkPacket;
     if (handler != null)
     {
         handler(this, networkPacketEvent);
     }
 }