Example #1
0
        public void Login(Session p, PacketRead r)
        {
            //33 = +1
            //1249 - normal
            try
            {
                byte[] Crc32  = new byte[] { 0x43, 0x7D, 0x7A, 0x7A };
                int    m_dwOK = 0;
                p.PInfo.m_strLogin  = r.String();
                p.PInfo.m_strPasswd = r.String();
                p.PInfo.m_bMale     = r.Bool();
                p.PInfo.m_iVersion  = r.Int();
                r.Int();
                byte[] checksum = r.Buffer_Array_Bytes(4);
                //Log.WriteHex("Checksum:",checksum);

                PacketWrite pw = new PacketWrite();

                Log.Write("clog : KTRUser::KSkTRUser::CheckLogin::User {0} and Passwd {1}", p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                int Login_Acess = Querys.Execute_VerifyAccount(p, p.PInfo.m_strLogin, p.PInfo.m_strPasswd);
                if (Login_Acess == 0)
                {
                    p.Req.ExpTable(p);
                    p.Req.ServerTime(p);
                    p.Req.NewCharChoice(p);
                    p.PCharacters.LoadCharacters(p.PInfo.m_strLogin, p.PInfo.m_dwUserUID);
                    p.PStages.LoadStages(p);
                    p.PInventory.InventoryItens(p);
                    p.PLetter.LoadLetter(p.PInfo.m_dwUserUID);
                    Log.Write("clog : KTRUser::KSkTRUser::OnClientLoginOK(), {0}-{1}-{2}.", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                }
                else if (Login_Acess == 14)
                {
                    m_dwOK = 7;
                }
                if (checksum != Crc32)
                {
                    m_dwOK = 10;
                }
                pw.UnicodeStr(p.PInfo.m_strLogin);
                pw.UnicodeStr(p.PInfo.m_strNickName);
                pw.Int(0);
                pw.Str(p.PInfo.m_strPasswd);
                pw.HexArray("00 2E 00 37 00 32 00 31 00 00 C8 72 D1 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
                pw.Byte(0);     //m_cAuthLevel
                pw.Int(100);    //m_iAge
                pw.Bool(false); //m_bAgreePrivateInfo
                pw.Byte(0);     //m_cPCBangType
                Serializables.m_mapCharacterInfo(p, pw);
                pw.UShort(GameServer.m_usUdpPort);
                pw.Int(p.PInfo.m_dwUserUID);
                pw.UnicodeStr(GameServer.m_strServerName);
                pw.Int(GameServer.m_iSessionInfo);
                pw.HexArray("00 00 00 00");
                Serializables.SerializeStages(p, pw);
                pw.UInt(3222798336);//C0 18 00 00 //m_nConnectType
                Serializables.m_vecMissionSlot(p, pw);
                pw.Int(0);
                pw.HexArray("29 E1 85 22 02 00 74 85 00 00 00 01 00 00 00 00 00 00 00 00");
                pw.UnicodeStr("MsgServer_02");
                pw.Str(GameServer.m_dwIP);
                pw.UShort(GameServer.m_usMsgPort);
                pw.HexArray("00 00 02 9D 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF");
                pw.Str(GameServer.m_dwIP);
                pw.HexArray("00 00 00 00 00 00 00 00 03 5A 35 55 C0 5A 35 55 C0 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01 61 D0 5E 60 00 D0 FF F9 3D AC 0C F9 74 00 5A 35 55 00 00 00 00 00 73 E6 5F 5A 33 2C A0 00 00 00 00");
                //Chars
                pw.HexArray("00 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 0B 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 0D 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 0E 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 13 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 00 14 00 00 00 00 00 00 00 00 00 00");
                pw.HexArray("00 00 00 03 00 00 00 C6 00 0C 22 CC 00 00 00 00 00 00 00 C7 00 0C F1 FC 00 00 00 00 00 00 00 C9 00 15 6D 0A 00 00 00 01");
                pw.Int(p.PInfo.m_dwSlots);
                pw.Byte(255);
                pw.Byte(0);
                pw.Byte(0);
                p.SendPacket(pw, 34);
                p.Shop.SendMyVirtualCash(p);
                p.HeroDugeons.HeroDungeonInfo(p);
                UdpPort(p);
                sends(p);
            }
            catch (Exception Ex)
            {
                Log.Write("{0} \n\n {1}", Ex.Message, Ex.StackTrace);
            }
        }