Пример #1
0
        public static void MyChar_Info_Req(InPacket lea, Client gc)
        {
            string[] data = lea.ReadString(lea.Available).Split(new[] { (char)0x20 }, StringSplitOptions.None);

            //int encryptKey = int.Parse(data[1]);
            string username = data[2];
            string password = data[4];

            gc.SetAccount(new Account(gc));



            try
            {
                Log.Debug("MyChar_Info_Req {0} ", "gc.Account.Load");
                gc.Account.Load(username);
                int    AccountStatus   = gc.Account.Banned;
                string AccountPassword = gc.Account.Password;


#if DEBUG
                Log.Debug("[LOG] Login Check has been bypass from DEBUG MODE");
#else
                if (!password.Equals(AccountPassword))
                {
                    gc.Dispose();
                }

                if (AccountStatus > 1)
                {
                    gc.Dispose();
                }
#endif



                gc.Account.Characters = new List <Character>();
                foreach (dynamic datum in new Datums("Characters").PopulateWith("id",
                                                                                "accountId = '{0}' && worldId = '{1}' ORDER BY position ASC", gc.Account.ID, gc.WorldID))
                {
                    Log.Debug("MyChar_Info_Req -> datum.id {0} -> username {1}", datum.id, gc.Account.Username);

                    Character character = new Character((int)datum.id, gc);
                    character.Load(false);
                    gc.Account.Characters.Add(character);
                }

                CharPacket.MyChar_Info_Ack(gc, gc.Account.Characters);
                Log.Success("Login Success! Username: {0}", username);

                Log.Debug("Password = {0}", password);
            }
            catch (NoAccountException)
            {
                gc.Dispose();
                Log.Error("Login Fail!");
            }
        }
Пример #2
0
        public static void MyChar_Info_Req(InPacket lea, Client gc)
        {
            string[] data = lea.ReadString(lea.Available).Split(new[] { (char)0x20 }, StringSplitOptions.None);
            int encryptKey = int.Parse(data[1]);
            string username = data[2];
            string password = data[4];

            gc.SetAccount(new Account(gc));

            try
            {
                gc.Account.Load(username);
                //var pe = new PasswordEncrypt(encryptKey);
                //string encryptPassword = pe.encrypt(gc.Account.Password, gc.RetryLoginCount > 0 ? password.ToCharArray() : null);

                if (password.Equals(gc.Account.Password))
                {
                    gc.Dispose();
                    Log.Error("Login Fail!");
                }
                else
                {
                    gc.Account.Characters = new List<Character>();
                    foreach (dynamic datum in new Datums("Characters").PopulateWith("id", "accountId = '{0}' && worldId = '{1}' ORDER BY position ASC", gc.Account.ID, gc.WorldID))
                    {
                        Character character = new Character(datum.id, gc);
                        character.Load(false);
                        gc.Account.Characters.Add(character);
                    }
                    CharPacket.MyChar_Info_Ack(gc, gc.Account.Characters);
                    Log.Success("Login Success!");
                }
                Log.Inform("Password = {0}", password);
                //Log.Inform("encryptKey = {0}", encryptKey);
                //Log.Inform("encryptPassword = {0}", encryptPassword);
            }
            catch (NoAccountException)
            {
                    gc.Dispose();
                    Log.Error("Login Fail!");
                }
            }