Ejemplo n.º 1
0
        static public void OnReceive(PacketIn packet)
        {
            lock (packet)
            {
                packet.Size   = packet.GetUint32();
                packet.Opcode = packet.GetUint8();

                Handle(packet);
            }
        }
Ejemplo n.º 2
0
        public static void OnReceive(PacketIn packet)
        {
            lock (packet)
            {
                packet.Size   = packet.GetUint32();
                packet.Opcode = packet.GetUint8();
                _logger.Debug($"OnReceive Packet size : {packet.Size} opCode : {packet.Opcode}");

                Handle(packet);
            }
        }
Ejemplo n.º 3
0
        public static void OnReceive(PacketIn packet)
        {
            lock (packet)
            {
                packet.Size = packet.GetUint32();
                packet.Opcode = packet.GetUint8();

                Handle(packet);
            }
        }
Ejemplo n.º 4
0
        public static void Handle(PacketIn packet)
        {
            if(!Enum.IsDefined(typeof(Opcodes),(byte)packet.Opcode))
            {
                Print("Invalid opcode : " + packet.Opcode.ToString("X02"));
                return;
            }

            switch((Opcodes)packet.Opcode)
            {
                case Opcodes.LCR_CHECK:

                    byte Result = packet.GetUint8();

                    switch((CheckResult)Result)
                    {
                        case CheckResult.LAUNCHER_OK:
                            Start();
                            break;
                        case CheckResult.LAUNCHER_VERSION:
                            string Message = packet.GetString();
                            Print(Message);
                            Close();
                            break;
                        case CheckResult.LAUNCHER_FILE:

                            string File = packet.GetString();
                            byte[] Bt = ASCIIEncoding.ASCII.GetBytes(File);

                            FileInfo Info = new FileInfo("mythloginserviceconfig.xml");
                            FileStream Str = Info.Create();
                            Str.Write(Bt, 0, Bt.Length);
                            Str.Close();
                            break;
                    }
                    break;

                case Opcodes.LCR_START:

                    Accueil.Acc.ReceiveStart();

                    byte Res = packet.GetUint8();

                    if (Res >= 1)
                    {
                        Print("Error : wrong account !\n\r");
                        return;
                    }
                    else
                    {
                        Auth = packet.GetString();
                        Print("Lancement avec : " + Auth);
                        try
                        {
                            // Je Fawk | 13 April 2014 | Modified to game folder path taken from from Accueil
                            string CurrentDir = Accueil.pathToGameFolder;
                            #region Old code
                            //string CurrentDir = Directory.GetCurrentDirectory();
                            #endregion Old code
                            patchExe();
                            UpdateWarData();
                            Process Pro = new Process();
                            Pro.StartInfo.FileName = "WAR.exe";
                            Pro.StartInfo.Arguments = " --acctname=" + System.Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(User)) + " --sesstoken=" + System.Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(Auth));
                            Pro.Start();
                            Directory.SetCurrentDirectory(CurrentDir);
                        }
                        catch (Exception e)
                        {
                            Print(e.ToString());
                        }
                    }

                    break;

                case Opcodes.LCR_INFO:
                    {
                        Accueil.Acc.ClearRealms();
                        byte RealmsCount = packet.GetUint8();
                        for (byte i = 0; i < RealmsCount; ++i)
                        {
                            bool Online = packet.GetUint8() > 0;
                            string Name = packet.GetString();
                            UInt32 OnlinePlayers = packet.GetUint32();
                            UInt32 OrderCount = packet.GetUint32();
                            UInt32 DestructionCount = packet.GetUint32();

                            Accueil.Acc.AddRealm(Name, Online, OnlinePlayers, DestructionCount, DestructionCount);

                        }
                    }break;
            }
        }
Ejemplo n.º 5
0
        static public void Handle(PacketIn packet)
        {
            if (!Enum.IsDefined(typeof(Opcodes), (byte)packet.Opcode))
            {
                Print("Invalid opcode : " + packet.Opcode.ToString("X02"));
                return;
            }

            switch ((Opcodes)packet.Opcode)
            {
            case Opcodes.LCR_CHECK:

                byte Result = packet.GetUint8();

                switch ((CheckResult)Result)
                {
                case CheckResult.LAUNCHER_OK:
                    Start();
                    break;

                case CheckResult.LAUNCHER_VERSION:
                    string Message = packet.GetString();
                    Print(Message);
                    Close();
                    break;

                case CheckResult.LAUNCHER_FILE:

                    string File = packet.GetString();
                    byte[] Bt   = ASCIIEncoding.ASCII.GetBytes(File);

                    FileInfo   Info = new FileInfo("mythloginserviceconfig.xml");
                    FileStream Str  = Info.Create();
                    Str.Write(Bt, 0, Bt.Length);
                    Str.Close();
                    break;
                }
                break;

            case Opcodes.LCR_START:

                Accueil.Acc.ReceiveStart();

                byte Res = packet.GetUint8();

                if (Res >= 1)
                {
                    Print("Error : wrong account !\n\r");
                    return;
                }
                else
                {
                    Auth = packet.GetString();
                    Print("Lancement avec : " + Auth);
                    try
                    {
                        string CurrentDir = Directory.GetCurrentDirectory();
                        patchExe();
                        UpdateWarData();
                        Process Pro = new Process();
                        Pro.StartInfo.FileName  = "WAR.exe";
                        Pro.StartInfo.Arguments = " --acctname=" + System.Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(User)) + " --sesstoken=" + System.Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(Auth));
                        Pro.Start();
                        Directory.SetCurrentDirectory(CurrentDir);
                    }
                    catch (Exception e)
                    {
                        Print(e.ToString());
                    }
                }

                break;

            case Opcodes.LCR_INFO:
            {
                Accueil.Acc.ClearRealms();
                byte RealmsCount = packet.GetUint8();
                for (byte i = 0; i < RealmsCount; ++i)
                {
                    bool   Online           = packet.GetUint8() > 0;
                    string Name             = packet.GetString();
                    UInt32 OnlinePlayers    = packet.GetUint32();
                    UInt32 OrderCount       = packet.GetUint32();
                    UInt32 DestructionCount = packet.GetUint32();

                    Accueil.Acc.AddRealm(Name, Online, OnlinePlayers, DestructionCount, DestructionCount);
                }
            } break;
            }
        }