Exemple #1
0
        protected override void HandleRequest()
        {
            DbAccount acc;
            var       status = Database.Verify(Query["guid"], Query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(Query["guid"]);
                }
                if (acc.Banned)
                {
                    using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream))
                        wtr.WriteLine("<Error>Account under maintenance</Error>");
                    Context.Response.Close();
                }

                var ca = new DbClassAvailability(acc);
                if (ca.IsNull)
                {
                    ca.Init(GameData);
                }
                ca.Flush();

                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                WriteLine(list.ToXml(Program.GameData, acc));
            }
            else
            {
                WriteErrorLine(status.GetInfo());
            }
        }
Exemple #2
0
        protected override void HandleRequest()
        {
            DbAccount acc;
            var       status = Database.Verify(Query["guid"], Query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(Query["guid"]);
                }

                var ca = new DbClassAvailability(acc);
                if (ca.IsNull)
                {
                    ca.Init(GameData);
                }
                ca.Flush();

                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                WriteLine(list.ToXml(Program.GameData, acc));
            }
            else
            {
                WriteErrorLine(status.GetInfo());
            }
        }
Exemple #3
0
        protected override void HandleRequest()
        {
            DbAccount acc;

            if (Query["guid"] == null || Query["password"] == null)
            {
                WriteErrorLine("Error.incorrectEmailOrPassword");
            }
            else
            {
                LoginStatus status = Database.Verify(Query["guid"], Query["password"], out acc);
                if (status == LoginStatus.OK)
                {
                    if (acc.Admin)
                    {
                        var ca = new DbClassAvailability(acc);
                        ca.Init(GameData);
                        ca.Flush();
                        WriteLine("<Success />");
                    }
                    else
                    {
                        WriteLine("<Failure />");
                    }
                }
                else
                {
                    WriteErrorLine("<Failure />");
                }
            }
        }
Exemple #4
0
        public static ClassAvailabilityList FromDb(DbAccount acc, DbClassAvailability ca)
        {
            var ret = new ClassAvailabilityList()
            {
                entries = new Dictionary <ushort, ClassAvailabilityEntry>()
            };

            foreach (var i in ca.AllKeys)
            {
                var type  = ushort.Parse(i);
                var entry = ClassAvailabilityEntry.FromDb(ca[type]);
                ret.entries[type] = entry;
            }
            return(ret);
        }