コード例 #1
0
        public void OnAccountInfoRequest(CM_ACCOUNT_INFO_REQUEST p)
        {
            SM_ACCOUNT_INFO p1 = new SM_ACCOUNT_INFO()
            {
                SessionID = p.SessionID
            };

            Logger.Log.Info(string.Format(this + ":Player:{0} is trying to login", p.Username));
            AccountLoginResult res = AccountDB.Instance.GetAccountID(p.Username, out uint accountID);

            switch (res)
            {
            case AccountLoginResult.OK:
                p1.Result  = AccountLoginResult.OK;
                p1.Account = AccountCache.Instance[accountID];
                break;

            case AccountLoginResult.NO_SUCH_ACCOUNT:
                p1.Result = AccountLoginResult.NO_SUCH_ACCOUNT;
                break;

            case AccountLoginResult.DB_ERROR:
                p1.Result = AccountLoginResult.DB_ERROR;
                break;
            }
            Logger.Log.Info(string.Format("Login result:{0}", res));
            Network.SendPacket(p1);
        }
コード例 #2
0
        public void RequestAccountInfo(string username, T client)
        {
            long session = Global.PacketSession;

            packetSessions[session] = client;

            CM_ACCOUNT_INFO_REQUEST p = new CM_ACCOUNT_INFO_REQUEST()
            {
                SessionID = session,
                Username  = username
            };

            Network.SendPacket(p);
        }