コード例 #1
0
ファイル: LadderLogin.cs プロジェクト: SettlersDev/S5Online
        protected void LadderLogin(Message msg)
        {
            var username = msg.Data[0].AsString;
            var game     = msg.Data[1].AsString;

            account = PlayerAccount.Get(username);
            if (account != null)
            {
                Connection.Send(msg.SuccessResponse(new DNodeList()));
            }
        }
コード例 #2
0
        void GetPlayerInfo(Message msg)
        {
            var username = msg.Data[0].AsString;

            var acc = PlayerAccount.Get(username);

            if (acc == null)
            {
                Connection.Send(msg.FailResponse(new DNodeList {
                    new DNodeBinary(1)
                }));
            }
            else
            {
                Connection.Send(msg.SuccessResponse(new DNodeList {
                    acc.IrcAlias, acc.Username, acc.FirstName, acc.LastName, acc.Language, acc.Email, acc.PublicIP
                }));
            }
        }
コード例 #3
0
        protected void LoginWaitModuleCmd(Message msg)
        {
            var username = msg.Data[0].AsString;

            account = PlayerAccount.Get(username);

            if (account != null)
            {
                Connection.Send(msg.SuccessResponse());
            }
            else
            {
                Connection.Send(msg.FailResponse(new DNodeList {
                    new DNodeBinary(2)
                }));
            }

            account.PublicIP = Connection.IP;
        }
コード例 #4
0
        protected void LoginCmd(Message msg)
        {
            var username = msg.Data[0].AsString;
            var password = msg.Data[1].AsString;
            var game     = msg.Data[2].AsString; // "SHOKPC1.05"

            var acc = PlayerAccount.Get(username);

            if (acc != null)
            {
                if (acc.CheckPassword(password))
                {
                    if (!PlayerAccount.LoggedInAccounts.Contains(acc))
                    {
                        PlayerAccount.LoggedInAccounts.Add(acc);
                        Connection.Send(msg.SuccessResponse());
                    }
                    else
                    {
                        Connection.Send(msg.FailResponse(new DNodeList {
                            new DNodeBinary((int)LoginResponses.AlreadyLoggedIn)
                        }));
                    }
                }
                else
                {
                    Connection.Send(msg.FailResponse(new DNodeList {
                        new DNodeBinary((int)LoginResponses.WrongPassword)
                    }));
                }
            }
            else
            {
                Connection.Send(msg.FailResponse(new DNodeList {
                    new DNodeBinary((int)LoginResponses.InvalidUsername)
                }));
            }
        }
コード例 #5
0
ファイル: LobbyServer.cs プロジェクト: SettlersDev/S5Online
        protected void LobbyServerLogin(Message msg)
        {
            var username    = msg.Data[0].AsString;
            var unknownNum  = msg.Data[1].AsInt;
            var localIP     = msg.Data[2].AsString;
            var localSubnet = msg.Data[3].AsString;
            var unknownNum2 = msg.Data[4].AsInt;

            Connection.WriteDebug("lobby server login ({0} | {1})", unknownNum, unknownNum2);

            account = PlayerAccount.Get(username);
            if (account != null)
            {
                account.LocalIP     = localIP;
                account.LocalSubnet = localSubnet;
                account.PublicIP    = Connection.IP;

                Connection.Send(new Message(MessageCode.GSSUCCESS, new DNodeList {
                    (int)MessageCode.LOBBYSERVERLOGIN, new DNodeList {
                        Constants.LOBBY_SERVER_ID
                    }
                }));
            }
        }