Beispiel #1
0
        public static void Auth_LoginGuest(Int32 worldId, String userToken, APICallbackHandler<Response> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Auth_Guest_Req"));
            reqPacket.PutInt32(0);  //  UserNo
            reqPacket.PutInt32(worldId);
            reqPacket.PutStringAsUtf16(userToken);

            _request.SendPacket(reqPacket, (resPacket) =>
            {
                Int32 ret = resPacket.GetInt32();
                if (ret == ResultCode.Ok)
                {
                    _userNo = resPacket.GetInt32();
                    _authKey = resPacket.GetInt32();
                    _request.HostAddress = resPacket.GetStringFromUtf16();
                    _request.HostPortNo = resPacket.GetInt32();
                    _request.ConnectionAliveTime = 0;
                    _request.Disconnect();

                    Auth_LoginGameServer(callback);
                }
                else
                    callback(new Response(ret));
            });
        }
Beispiel #2
0
        public static void GameData_CharacterBook(Int32 startId, APICallbackHandler<Response_CharacterBook> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_GameData_CharacterBook_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(startId);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_CharacterBook(resPacket)); });
        }
Beispiel #3
0
        ////////////////////////////////////////////////////////////////////////////////
        //  Game Data
        public static void GameData_Codes(APICallbackHandler<Response_GameData_Codes> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_GameData_Codes_Req"));
            reqPacket.PutInt32(_userNo);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_GameData_Codes(resPacket)); });
        }
Beispiel #4
0
        public static void Auth_RegisterGuest(String userToken, APICallbackHandler<Response> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Auth_RegisterGuest_Req"));
            reqPacket.PutInt32(0);  //  UserNo
            reqPacket.PutStringAsUtf16(userToken);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response(resPacket)); });
        }
Beispiel #5
0
        public static void Auth_LoginGuest(string uuid, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Auth_LoginGuest_Req"));
            reqPacket.PutInt32(0);
            reqPacket.PutStringAsUtf16(uuid);

            _request.SendPacket(reqPacket,
                               (resPacket) =>
                               {
                                   Int32 ret = resPacket.GetInt32();
                                   if (ret == ResultCode.Ok)
                                       _userNo = resPacket.GetInt32();

                                   callback(new ResponseBase(resPacket));
                               });
        }
Beispiel #6
0
        public static void Profile_GetTextData(APICallbackHandler<Response_Profile_Text> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Profile_Text_GetData_Req"));
            reqPacket.PutInt32(_userNo);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new Response_Profile_Text(resPacket)); });
        }
Beispiel #7
0
        public static void IMC_SendMessage(int targetUserNo, StreamBuffer data, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_IMC_SendMessage_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(targetUserNo);
            reqPacket.Write(data.Buffer);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #8
0
        public static void IMC_UserList(APICallbackHandler<Response_IMC_UserList> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_IMC_UserList_Req"));
            reqPacket.PutInt32(_userNo);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new Response_IMC_UserList(resPacket)); });
        }
Beispiel #9
0
        public static void IMC_Create(string channelName, APICallbackHandler<Response_IMC_Create> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_IMC_Create_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(channelName);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new Response_IMC_Create(resPacket)); });
        }
Beispiel #10
0
        public static void IMC_Enter(int channelNo, APICallbackHandler<Response_IMC_Enter> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_IMC_Enter_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(channelNo);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new Response_IMC_Enter(resPacket)); });
        }
Beispiel #11
0
        ////////////////////////////////////////////////////////////////////////////////
        //  CacheBox
        public static void CacheBox_SetValue(string key, string value, int durationMinutes, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CacheBox_SetValue_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(key);
            reqPacket.PutStringAsUtf16(value);
            reqPacket.PutInt32(durationMinutes);
            reqPacket.PutDouble(-1);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #12
0
        public static void CacheBox_SetValue(string key, string value, DateTime expireTime, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CacheBox_SetValue_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(key);
            reqPacket.PutStringAsUtf16(value);
            reqPacket.PutInt32(-1);
            reqPacket.PutDouble(expireTime.ToUniversalTime().ToOADate());

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #13
0
        private static void OnRecv_Storage_Sheet_GetSheetList(SecurePacket packet, APICallbackHandler<ResponseBase> callback)
        {
            int sheetCount = packet.GetInt32();
            while (sheetCount-- > 0)
            {
                string sheetName = packet.GetStringFromUtf16();
                int recordCount = packet.GetInt32();
                int columnCount = packet.GetInt32();

                Sheet sheet = Workbook.AddSheet(sheetName, recordCount, columnCount);
                while (columnCount-- > 0)
                {
                    FieldDataType type = (FieldDataType)packet.GetInt32();
                    string fieldname = packet.GetStringFromUtf16();

                    sheet.AddField(type, fieldname);
                }
            }

            if (Workbook.Sheets.Count() == 0)
            {
                callback(new ResponseBase(ResultCode.Ok));
                return;
            }

            _sheetRequestedNo = 0;
            _sheetName = Workbook.Sheets[_sheetRequestedNo].Name;

            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CloudSheet_GetRecords_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(_sheetFilename);
            reqPacket.PutStringAsUtf16(_sheetName);
            reqPacket.PutUInt32(0);

            _request.SendPacket(reqPacket,
                (resPacket) =>
                {
                    ResponseBase response = new ResponseBase(resPacket);
                    if (response.ResultCodeNo != ResultCode.Ok)
                    {
                        callback(response);
                        return;
                    }

                    OnRecv_Storage_Sheet_GetRecords(resPacket, callback);
                });
        }
Beispiel #14
0
        ////////////////////////////////////////////////////////////////////////////////
        //  PvE
        public static void PvE_GetDeck(DeckType deckType, APICallbackHandler<Response_PvE_PlayDeck> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_PvE_GetDeck_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32((Int32)deckType);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_PvE_PlayDeck(resPacket)); });
        }
Beispiel #15
0
        public static void Profile_SetData(string nickname, Int16 level, Int16 exp, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Profile_SetData_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(nickname);
            reqPacket.PutInt16(level);
            reqPacket.PutInt16(exp);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #16
0
        public static void Storage_Sheet_Refresh(string filename, APICallbackHandler<ResponseBase> callback)
        {
            _sheetFilename = filename;

            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CloudSheet_GetSheetList_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(_sheetFilename);

            _request.SendPacket(reqPacket,
                (resPacket) =>
                {
                    ResponseBase response = new ResponseBase(resPacket);
                    if (response.ResultCodeNo != ResultCode.Ok)
                    {
                        callback(response);
                        return;
                    }

                    Workbook = new Workbook();
                    OnRecv_Storage_Sheet_GetSheetList(resPacket, callback);
                });
        }
Beispiel #17
0
        public static void PvE_SetDeck(DeckType deckType, Int32[] characterNo, APICallbackHandler<Response> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_PvE_SetDeck_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32((Int32)deckType);
            reqPacket.PutInt32(characterNo.Length);
            for (Int32 i = 0; i < characterNo.Length; ++i)
            {
                reqPacket.PutInt32(i);
                reqPacket.PutInt32(characterNo[i]);
            }

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response(resPacket)); });
        }
Beispiel #18
0
 public static void Auth_WorldList(APICallbackHandler<Response_WorldList> callback)
 {
     SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Auth_WorldList_Req"));
     reqPacket.PutInt32(0);  //  UserNo
     _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_WorldList(resPacket)); });
 }
Beispiel #19
0
        ////////////////////////////////////////////////////////////////////////////////
        //  User Data
        public static void UserData_Init(String nickname, APICallbackHandler<Response> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_UserData_InitUser_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(nickname);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response(resPacket)); });
        }
Beispiel #20
0
        public static void UserData_UserInfo(APICallbackHandler<Response_UserInfo> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_UserData_UserInfo_Req"));
            reqPacket.PutInt32(_userNo);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_UserInfo(resPacket)); });
        }
Beispiel #21
0
        private static void Auth_LoginGameServer(APICallbackHandler<Response> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Login_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(_authKey);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response(resPacket)); });
        }
Beispiel #22
0
        public static void Profile_SetTextData(string text, APICallbackHandler<ResponseBase> callback)
        {
            if (text.Length > 32500)
                throw new AegisException("The 'text' length must be less than 32500.");

            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Profile_Text_SetData_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(text);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #23
0
        public static void PvE_DungeonList(Int32 parentField, APICallbackHandler<Response_PvE_DungeonList> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_PvE_DungeonList_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(parentField);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_PvE_DungeonList(resPacket)); });
        }
Beispiel #24
0
        private static void OnRecv_Storage_Sheet_GetRecords(SecurePacket packet, APICallbackHandler<ResponseBase> callback)
        {
            try
            {
                Boolean hasMore = (packet.GetByte() == 1);
                int rowCount = packet.GetInt32();
                UInt32 rowNo = 0;
                Sheet table = Workbook.GetSheet(_sheetName);

                while (rowCount-- > 0)
                {
                    string[] values = new string[table.Fields.Count()];

                    rowNo = packet.GetUInt32();
                    for (int i = 0; i < table.Fields.Count(); ++i)
                        values[i] = packet.GetStringFromUtf16();

                    table.AddRowData(rowNo, values);
                }

                if (hasMore)
                {
                    SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CloudSheet_GetRecords_Req"));
                    reqPacket.PutInt32(_userNo);
                    reqPacket.PutStringAsUtf16(_sheetFilename);
                    reqPacket.PutStringAsUtf16(_sheetName);
                    reqPacket.PutUInt32(rowNo + 1);

                    _request.SendPacket(reqPacket,
                        (resPacket) =>
                        {
                            ResponseBase response = new ResponseBase(resPacket);
                            if (response.ResultCodeNo != ResultCode.Ok)
                            {
                                callback(response);
                                return;
                            }

                            OnRecv_Storage_Sheet_GetRecords(resPacket, callback);
                        });
                }
                else
                {
                    ++_sheetRequestedNo;
                    if (Workbook.Sheets.Count() > _sheetRequestedNo)
                    {
                        table = Workbook.Sheets[_sheetRequestedNo];
                        _sheetName = table.Name;

                        SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CloudSheet_GetRecords_Req"));
                        reqPacket.PutInt32(_userNo);
                        reqPacket.PutStringAsUtf16(_sheetFilename);
                        reqPacket.PutStringAsUtf16(_sheetName);
                        reqPacket.PutUInt32(0);

                        _request.SendPacket(reqPacket,
                            (resPacket) =>
                            {
                                ResponseBase response = new ResponseBase(resPacket);
                                if (response.ResultCodeNo != ResultCode.Ok)
                                {
                                    callback(response);
                                    return;
                                }

                                OnRecv_Storage_Sheet_GetRecords(resPacket, callback);
                            });
                    }
                    else
                    {
                        callback(new ResponseBase(packet));
                    }
                }
            }
            catch (Exception)
            {
                callback(new ResponseBase(ResultCode.UnknownError));
            }
        }
Beispiel #25
0
        public static void Auth_RegisterMember(string uuid, string userId, string userPwd, APICallbackHandler<ResponseBase> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_Auth_RegisterMember_Req"));
            reqPacket.PutInt32(0);
            reqPacket.PutStringAsUtf16(uuid);
            reqPacket.PutStringAsUtf16(userId);
            reqPacket.PutStringAsUtf16(userPwd);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new ResponseBase(resPacket)); });
        }
Beispiel #26
0
        public static void CacheBox_GetValue(string key, APICallbackHandler<Response_CacheBox_Value> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_CacheBox_GetValue_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutStringAsUtf16(key);

            _request.SendPacket(reqPacket,
                       (resPacket) => { callback(new Response_CacheBox_Value(resPacket)); });
        }
Beispiel #27
0
        public static void PvE_EnterDungeon(Int32 dungeonId, APICallbackHandler<Response_PvE_EnterDungeon> callback)
        {
            SecurePacket reqPacket = new SecurePacket(Protocol.GetID("CS_PvE_EnterDungeon_Req"));
            reqPacket.PutInt32(_userNo);
            reqPacket.PutInt32(dungeonId);

            _request.SendPacket(reqPacket, (resPacket) => { callback(new Response_PvE_EnterDungeon(resPacket)); });
        }