Beispiel #1
0
        /// <summary>
        ///     Login - Check username/password. Proceed to Game Server.
        /// </summary>
        protected override void Format03Handler(LoginClient client, ClientFormat03 format)
        {
            try
            {
                var _aisling = StorageManager.AislingBucket.Load(format.Username);

                if (_aisling != null)
                {
                    if (_aisling.Password != format.Password)
                    {
                        client.SendMessageBox(0x02, "Incorrect Password.");
                        return;
                    }
                }
                else
                {
                    client.SendMessageBox(0x02, string.Format("{0} does not exist in the world of lorule.", format.Username));
                    return;
                }
            }
            catch
            {
                client.SendMessageBox(0x02, string.Format("{0} is not supported by the new server. Please remake your character. This will not happen when the server goes to beta.", format.Username));
                return;
            }

            var aislings = GetObjects <Aisling>(i => i.Username == format.Username && format.Password == i.Password);

            foreach (var aisling in aislings)
            {
                aisling.Client.SendMessage(0x02, "You have been replaced by someone else.");
                aisling.Client.Server.ClientDisconnected(aisling.Client);
            }

            var redirect = new Redirect
            {
                Serial = client.Serial,
                Salt   = client.Encryption.Parameters.Salt,
                Seed   = client.Encryption.Parameters.Seed,
                Name   = format.Username
            };

            ServerContext.GlobalRedirects.Add(redirect);

            client.SendMessageBox(0x00, "\0");

            client.Send(new ServerFormat03
            {
                EndPoint = new IPEndPoint(Address, ServerContext.DefaultPort),
                Redirect = redirect
            });
        }
        /// <summary>
        ///     Login - Check username/password. Proceed to Game Server.
        /// </summary>
        protected override void Format03Handler(LoginClient client, ClientFormat03 format)
        {
            try
            {
                var _aisling = StorageManager.AislingBucket.Load(format.Username);

                if (_aisling != null)
                {
                    if (_aisling.Password != format.Password)
                    {
                        client.SendMessageBox(0x02, "Incorrect Password bud.");
                        return;
                    }
                    _aisling = null;
                }
                else
                {
                    client.SendMessageBox(0x02, string.Format("{0} Does not exist.", format.Username));
                    return;
                }
            }
            catch
            {
                client.SendMessageBox(0x02, string.Format("{0} has been blocked.", format.Username));
                return;
            }

            var aislings = GetObjects <Aisling>(i => i.Username == format.Username && format.Password == i.Password);

            foreach (var aisling in aislings)
            {
                aisling.Client.SendMessage(0x02, "You have been replaced by someone else.");
                aisling.Client.Server.ClientDisconnected(aisling.Client);
            }

            var redirect = new Redirect
            {
                Serial = client.Serial,
                Salt   = client.Encryption.Parameters.Salt,
                Seed   = client.Encryption.Parameters.Seed,
                Name   = format.Username
            };

            ServerContext.GlobalRedirects.Add(redirect);

            client.SendMessageBox(0x00, "\0");
            client.Send(new ServerFormat03
            {
                EndPoint = new IPEndPoint(Address, ServerContext.DEFAULT_PORT),
                Redirect = redirect
            });
        }
Beispiel #3
0
        /// <summary>
        ///     Login - Check username/password. Proceed to Game Server.
        /// </summary>
        protected override void Format03Handler(LoginClient client, ClientFormat03 format)
        {
            Aisling _aisling = null;

            try
            {
                _aisling = StorageManager.AislingBucket.Load(format.Username);

                if (_aisling != null)
                {
                    if (_aisling.Password != format.Password)
                    {
                        client.SendMessageBox(0x02, "Sorry, Incorrect Password.");
                        return;
                    }
                }
                else
                {
                    client.SendMessageBox(0x02,
                                          string.Format(
                                              "{0} does not exist in this world. You can make this hero by clicking on 'Create'.",
                                              format.Username));
                    return;
                }
            }
            catch (Exception e)
            {
                client.SendMessageBox(0x02,
                                      string.Format(
                                          "{0} is not supported by the new server. Please remake your character. This will not happen when the server goes to beta.",
                                          format.Username));

                ServerContext.Report(e);

                return;
            }

            if (!ServerContext.Config.MultiUserLogin)
            {
                var aislings = GetObjects <Aisling>(null,
                                                    i => i.Username.ToLower() == format.Username.ToLower() &&
                                                    format.Password == i.Password);

                foreach (var aisling in aislings)
                {
                    aisling.Client.Server.ClientDisconnected(aisling.Client);
                }
            }

            LoginAsAisling(client, _aisling);
        }
Beispiel #4
0
        /// <summary>
        ///     Login - Check username/password. Proceed to Game Server.
        /// </summary>
        protected override void Format03Handler(LoginClient client, ClientFormat03 format)
        {
            Aisling _aisling = null;

            try
            {
                _aisling = StorageManager.AislingBucket.Load(format.Username);

                if (_aisling != null)
                {
                    if (_aisling.Password != format.Password)
                    {
                        client.SendMessageBox(0x02, "Sorry, Incorrect Password.");
                        return;
                    }
                }
                else
                {
                    client.SendMessageBox(0x02, string.Format("{0} does not exist in this world. You can make this hero by clicking on 'Create'.", format.Username));
                    return;
                }
            }
            catch
            {
                client.SendMessageBox(0x02, string.Format("{0} is not supported by the new server. Please remake your character. This will not happen when the server goes to beta.", format.Username));
                return;
            }


            if (_aisling != null)
            {
                ServerContext.Info?.Info("Player Entering Game: {0}", _aisling.Username);

                var redirect = new Redirect
                {
                    Serial = Convert.ToString(client.Serial),
                    Salt   = System.Text.Encoding.UTF8.GetString(client.Encryption.Parameters.Salt),
                    Seed   = Convert.ToString(client.Encryption.Parameters.Seed),
                    Name   = _aisling.Username
                };

                client.SendMessageBox(0x00, "\0");

                client.Send(new ServerFormat03
                {
                    EndPoint = new IPEndPoint(Address, ServerContext.DefaultPort),
                    Redirect = redirect
                });
            }
        }
        protected override void Format03Handler(LoginClient client, ClientFormat03 format)
        {
            Aisling aisling = null;

            try
            {
                aisling = StorageManager.AislingBucket.Load(format.Username);

                if (aisling != null)
                {
                    if (aisling.Password != format.Password)
                    {
                        client.SendMessageBox(0x02, "Sorry, Incorrect Password.");
                        return;
                    }
                }
                else
                {
                    client.SendMessageBox(0x02,
                                          $"{format.Username} does not exist in this world. You can make this hero by clicking on 'Create'.");
                    return;
                }
            }
            catch (Exception ex)
            {
                ServerContext.Logger(ex.Message, Microsoft.Extensions.Logging.LogLevel.Error);
                ServerContext.Logger(ex.StackTrace, Microsoft.Extensions.Logging.LogLevel.Error);

                client.SendMessageBox(0x02,
                                      $"{format.Username} is not supported by the new server. Please remake your character. This will not happen when the server goes to beta.");

                return;
            }

            if (!ServerContext.Config.MultiUserLogin)
            {
                var aislings = ServerContext.Game.Clients.Where(i =>
                                                                i?.Aisling != null && i.Aisling.LoggedIn &&
                                                                i.Aisling.Username.ToLower() == format.Username.ToLower());

                foreach (var obj in aislings)
                {
                    obj.Aisling?.Remove(true);
                    obj.Server.ClientDisconnected(obj);
                }
            }

            LoginAsAisling(client, aisling);
        }
Beispiel #6
0
 protected virtual void Format03Handler(TClient client, ClientFormat03 format)
 {
 }