internal Response_PvE_EnterDungeon(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                RoundData round = new RoundData();
                round.RoundId = packet.GetInt32();
                round.Name = packet.GetStringFromUtf16();
                round.IsBossRound = packet.GetBoolean();
                round.Monsters = new List<MonsterData>();
                Rounds.Add(round);

                Int32 monsterCount = packet.GetInt32();
                while (monsterCount-- > 0)
                {
                    MonsterData monster = new MonsterData();
                    monster.MonsterNo = packet.GetInt32();
                    monster.MonsterId = packet.GetInt32();
                    monster.Name = packet.GetStringFromUtf16();
                    monster.GradeId = packet.GetInt32();
                    monster.PromotionId = packet.GetInt32();
                    monster.Level = packet.GetInt32();
                    round.Monsters.Add(monster);
                }
            }
        }
Esempio n. 2
0
        internal Response_IMC_ChannelList(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            int count = packet.GetInt32();
            while (count-- > 0)
            {
                Channels.Add(new ChannelInfo()
                {
                    ChannelNo = packet.GetInt32(),
                    ChannelName = packet.GetStringFromUtf16()
                });
            }
        }
Esempio n. 3
0
        internal Response_CacheBox_Value(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Value = packet.GetStringFromUtf16();
            DurationMinutes = packet.GetInt32();
        }
        internal Response_PvE_DungeonList(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new Data()
                {
                    DungeonId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    Level = packet.GetInt32(),
                    EnterFee_EnergyId = packet.GetInt32(),
                    EnterFee_Amount = packet.GetInt32()
                });
            }
        }
Esempio n. 5
0
        internal Response_InvenItem(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            MaxInventoryCount = packet.GetInt32();

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new ItemData()
                {
                    ItemNo = packet.GetInt32(),
                    ItemId = packet.GetInt32(),
                    PromotionId = packet.GetInt32(),
                    Quantity = packet.GetInt32()
                });
            }
        }
Esempio n. 6
0
        internal Response_InvenCharacter(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            MainCharacterNo = packet.GetInt32();
            MaxInventoryCount = packet.GetInt32();

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new CharacterData()
                {
                    CharacterNo = packet.GetInt32(),
                    CharacterId = packet.GetInt32(),
                    Level = packet.GetInt32(),
                    Exp = packet.GetInt32(),
                    GradeId = packet.GetInt32(),
                    PromotionId = packet.GetInt32()
                });
            }
        }
Esempio n. 7
0
        private static void OnHello(SecurePacket packet)
        {
            Int32 seed = packet.GetInt32();
            String characterSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
            char[] ascii = new char[16];

            for (Int32 i = 0; i < 16; ++i)
            {
                Int32 val = seed & (0x6E << i);
                ascii[i] = characterSet[(val % characterSet.Length)];
            }
            _request.AESIV = new String(ascii);

            for (Int32 i = 0; i < 16; ++i)
            {
                Int32 val = seed & (0xF4 << i);
                ascii[i] = characterSet[(val % characterSet.Length)];
            }
            _request.AESKey = new String(ascii);

            _request.EnableSend = true;
        }
Esempio n. 8
0
        internal Response_WorldList(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new WorldInfo()
                {
                    WorldId = packet.GetInt32(),
                    WorldName = packet.GetStringFromUtf16()
                });
            }
        }
Esempio n. 9
0
        internal Response_UserInfo(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count;

            Nickname = packet.GetStringFromUtf16();
            Level = packet.GetInt32();
            Exp = packet.GetInt32();
            VIPLevel = packet.GetInt32();
            VIPExp = packet.GetInt32();

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Energies.Add(new EnergyData()
                {
                    EnergyId = packet.GetInt32(),
                    Point = packet.GetInt32(),
                    RemainSecond = packet.GetInt32()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Resources.Add(new ResourceData()
                {
                    ResourceId = packet.GetInt32(),
                    Point = packet.GetInt32()
                });
            }
        }
Esempio n. 10
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);
                });
        }
Esempio n. 11
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));
            }
        }
        internal Response_GameData_Codes(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count;

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Energy.Add(new EnergyData()
                {
                    EnergyId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Resource.Add(new ResourceData()
                {
                    ResourceId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Race.Add(new RaceData()
                {
                    RaceId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                DamageType.Add(new DamageTypeData()
                {
                    DamageTypeId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Grade.Add(new GradeData()
                {
                    GradeId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    GradeType = packet.GetInt32(),
                    Priority = packet.GetInt32()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Promotion.Add(new PromotionData()
                {
                    PromotionId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    PromotionType = packet.GetInt32(),
                    Priority = packet.GetInt32()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Job.Add(new JobData()
                {
                    JobId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                CharacterType.Add(new CharacterTypeData()
                {
                    CharacterTypeId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16()
                });
            }

            count = packet.GetInt32();
            while (count-- > 0)
            {
                Position.Add(new PositionData()
                {
                    PositionId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    PositionType = packet.GetInt32()
                });
            }
        }
        internal Response_MonsterBook(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new Data()
                {
                    MonsterId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    MonsterTypeId = packet.GetInt32(),
                    PositionId = packet.GetInt32(),
                    GradeId = packet.GetInt32(),
                    PromotionId = packet.GetInt32(),
                    DamageTypeId = packet.GetInt32(),
                    FixedLevel = packet.GetInt32(),
                    AP = packet.GetInt32(),
                    DP = packet.GetInt32(),
                    HP = packet.GetInt32()
                });
            }
        }
        internal Response_CharacterBook(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new Data()
                {
                    CharacterId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    RaceId = packet.GetInt32(),
                    CharacterTypeId = packet.GetInt32(),
                    JobId = packet.GetInt32(),
                    PositionId = packet.GetInt32(),
                    DamageTypeId = packet.GetInt32(),
                    InitGradeId = packet.GetInt32(),
                    InitPromotionId = packet.GetInt32(),
                    MaxGradeId = packet.GetInt32(),
                    MaxPromotionId = packet.GetInt32(),
                    AP = packet.GetInt32(),
                    DP = packet.GetInt32(),
                    HP = packet.GetInt32()
                });
            }
        }
Esempio n. 15
0
        internal Response_IMC_Enter(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            ChannelNo = packet.GetInt32();
            ChannelName = packet.GetStringFromUtf16();
        }
        internal Response_PvE_PlayDeck(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new Data()
                {
                    SlotNo = packet.GetInt32(),
                    CharacterNo = packet.GetInt32()
                });
            }
        }
Esempio n. 17
0
        internal Response_IMC_EnteredUser(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            UserNo = packet.GetInt32();
            Nickname = packet.GetStringFromUtf16();
        }
Esempio n. 18
0
        internal Response_IMC_LeavedUser(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            UserNo = packet.GetInt32();
        }
Esempio n. 19
0
        internal Response_IMC_UserList(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            int count = packet.GetInt32();
            while (count-- > 0)
            {
                Users.Add(new UserData()
                {
                    UserNo = packet.GetInt32(),
                    Nickname = packet.GetStringFromUtf16()
                });
            }
        }
Esempio n. 20
0
        internal Response_IMC_Message(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            SenderUserNo = packet.GetInt32();
            Message = new StreamBuffer(packet.Buffer, packet.ReadBytes, packet.ReadableSize);
        }
        internal Response_PvE_WorldList(SecurePacket packet)
            : base(packet)
        {
            if (ResultCodeNo != ResultCode.Ok)
                return;

            Int32 count = packet.GetInt32();
            while (count-- > 0)
            {
                Items.Add(new Data()
                {
                    WorldId = packet.GetInt32(),
                    Name = packet.GetStringFromUtf16(),
                    NeedVIPLevel = packet.GetInt32(),
                    NeedPlayerLevel = packet.GetInt32(),
                    NeedCharacterLevel = packet.GetInt32()
                });
            }
        }
Esempio n. 22
0
 public Response(SecurePacket packet)
 {
     Packet = packet;
     Packet.SkipHeader();
     ResultCodeNo = packet.GetInt32();
 }