Esempio n. 1
0
 private static void MessageReceived(Message obj)
 {
     if (obj.Direction == MessageDirection.ClientToServer && obj.OpCode == 19900)
     {
         var message = new C_CHECK_VERSION_CUSTOM(new CustomReader(obj));
         Version = message.Versions[0];
         OpcodeDownloader.DownloadIfNotExist(Version, Path.Combine(BasicTeraData.Instance.ResourceDirectory, "data/opcodes/"));
         if (!File.Exists(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/{message.Versions[0]}.txt")) && !File.Exists(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/protocol.{message.Versions[0]}.map")) ||
             !File.Exists(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/smt_{message.Versions[0]}.txt")) && !File.Exists(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/sysmsg.{message.Versions[0]}.map")))
         {
             {
                 TccMessageBox.Show("Unknown client version: " + message.Versions[0], MessageBoxType.Error);
                 App.CloseApp();
                 return;
             }
         }
         OpCodeNamer                    = new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/{message.Versions[0]}.txt"));
         SystemMessageNamer             = new OpCodeNamer(Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/smt_{message.Versions[0]}.txt"));
         Factory                        = new MessageFactory(OpCodeNamer, Server.Region, message.Versions[0], sysMsgNamer: SystemMessageNamer);
         TeraSniffer.Instance.Connected = true;
         Proxy.ConnectToProxy();
         return;
     }
     Packets.Enqueue(obj);
 }
            public static void NetThread()
            {
                //TCTSniffer.SnifferProgram.startNewSniffingSession();
                DamageMeter.Sniffing.TeraSniffer.Instance.Enabled          = true;
                DamageMeter.Sniffing.TeraSniffer.Instance.MessageReceived += (message) =>
                {
                    if (message.Direction == MessageDirection.ClientToServer && message.OpCode == 19900)
                    {
                        var msg = new C_CHECK_VERSION_CUSTOM(new CustomReader(message));
                        DamageMeter.Sniffing.TeraSniffer.Instance.opn = new OpCodeNamer(System.IO.Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/{msg.Versions[0]}.txt"));
                        TCTParser.DataRouter.OpCodeNamer       = DamageMeter.Sniffing.TeraSniffer.Instance.opn;
                        TCTParser.DataRouter.SystemOpCodeNamer = new OpCodeNamer(System.IO.Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/smt_{msg.Versions[0]}.txt"));
                        TCTParser.DataRouter.Version           = msg.Versions[0];
                    }

                    TCTParser.DataRouter.StoreMessage(message);
                };
                DamageMeter.Sniffing.TeraSniffer.Instance.NewConnection += (server) =>
                {
                    TCTNotifier.NotificationProvider.SendNotification(String.Format("Connected to:\n{0} - {1}", server.Region, server.Name), TCTData.Enums.NotificationImage.Connected, TCTData.Enums.NotificationType.Standard, TCTData.Colors.BrightGreen, true, false, false);
                    UI.SetLogColor(TCTData.Colors.SolidGreen);
                    UI.UpdateLog(String.Format("Connected to: {0} - {1}", server.Region, server.Name));
                };
                DamageMeter.Sniffing.TeraSniffer.Instance.EndConnection += () =>
                {
                    TCTNotifier.NotificationProvider.SendNotification("Connection lost.", TCTData.Enums.NotificationImage.Connected, TCTData.Enums.NotificationType.Standard, TCTData.Colors.BrightRed, true, false, false);
                    UI.SetLogColor(TCTData.Colors.SolidRed);
                    UI.UpdateLog("Connection lost.");
                };
            }
 public static void MessageReceived(global::Tera.Message obj)
 {
     if (obj.Direction == Tera.MessageDirection.ClientToServer && obj.OpCode == 19900)
     {
         var msg = new C_CHECK_VERSION_CUSTOM(new CustomReader(obj));
         Version = msg.Versions[0];
         TeraSniffer.Instance.opn = new OpCodeNamer(System.IO.Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/{Version}.txt"));
         OpCodeNamer        = TeraSniffer.Instance.opn;
         SystemMessageNamer = new OpCodeNamer(System.IO.Path.Combine(BasicTeraData.Instance.ResourceDirectory, $"data/opcodes/smt_{Version}.txt"));
         MessageFactory.Init();
     }
     Packets.Enqueue(obj);
 }