Ejemplo n.º 1
0
        public static void HandlePacket(WorldClient client, CMSG msgID, BinReader data)
        {
            DebugLogger.ILog("Handling CMSG packet: " + msgID);

            bool handled = false;

            try {
                IWorldClientPacketHandler handler = (IWorldClientPacketHandler)worldClientHandlers[msgID];
                if (handler != null)
                {
                    handler.HandlePacket(client, msgID, data);
                    handled = true;
                }
                WorldClientPacketDelegate wcpd = (WorldClientPacketDelegate)worldClientDelegates[(int)msgID];
                if (wcpd != null)
                {
                    wcpd(client, msgID, data);
                    handled = true;
                }
            } catch (Exception exp) {
                DebugLogger.Logger.Log("", exp);
            }

            if (handled == false)
            {
                DebugLogger.ILog("Unhandled CMSG: " + msgID.ToString());
            }
        }
Ejemplo n.º 2
0
 public static void RegisterPacketHandler(CMSG msgID, IWorldClientPacketHandler handler)
 {
     if (worldClientHandlers.Contains(msgID))
     {
         throw new Exception("There's already a worldclient packet handler for " + msgID);
     }
     worldClientHandlers[msgID] = handler;
 }
Ejemplo n.º 3
0
        public static void HandlePacket(WorldClient client, CMSG msgID, BinReader data)
        {
            IWorldClientPacketHandler handler = (IWorldClientPacketHandler)worldClientHandlers[msgID];

            if (handler != null)
            {
                handler.HandlePacket(client, msgID, data);
            }
            WorldClientPacketDelegate wcpd = (WorldClientPacketDelegate)worldClientDelegates[(int)msgID];

            if (wcpd != null)
            {
                wcpd(client, msgID, data);
            }
        }
 public static void HandlePacket(WorldClient client, CMSG msgID, BinReader data)
 {
     try {
         IWorldClientPacketHandler handler = (IWorldClientPacketHandler)worldClientHandlers[msgID];
         if (handler != null)
         {
             handler.HandlePacket(client, msgID, data);
         }
         WorldClientPacketDelegate wcpd = (WorldClientPacketDelegate)worldClientDelegates[(int)msgID];
         if (wcpd != null)
         {
             wcpd(client, msgID, data);
         }
     } catch (Exception exp) {
         DebugLogger.Log("", exp);
     }
 }