コード例 #1
0
ファイル: QueryTickCount.cs プロジェクト: homiedopie/SharpFly
        public QueryTickCount(uint time, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.QUERY_TICK_COUNT);

            packet.Write(time);
            packet.Write((uint)DateTime.Now.Ticks);
            packet.Send(socket);
        }
コード例 #2
0
ファイル: AuthQuery.cs プロジェクト: homiedopie/SharpFly
        public AuthQuery(int value1, int value2, int value3, int value4, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.PONG);

            packet.Write(value1);
            packet.Write(value2);
            packet.Write(value3);
            packet.Write(value4);
            packet.Send(socket);
        }
コード例 #3
0
ファイル: CharacterList.cs プロジェクト: Mootie/SharpFly
        public CharacterList(uint TimeGetTime, Socket socket)
        {
            // not finished

            OutgoingPacket packet = new OutgoingPacket(OpCodes.CHARACTER_LIST);

            packet.Write(TimeGetTime);

            // if 0 characters
            packet.Write(0);
            packet.Write(0);
            packet.Send(socket);

            // if >0 characters
        }
コード例 #4
0
ファイル: Pong.cs プロジェクト: Mootie/SharpFly
        public Pong(int time, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.PONG);

            packet.Write(time);
            packet.Send(socket);
        }
コード例 #5
0
        public LoginFail(uint errorCode, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.LOGIN_MESSAGE);

            packet.Write(errorCode);
            packet.Send(socket);
        }
コード例 #6
0
        public void SendPacket(OutgoingPacket packet)
        {
            if (!_socket.Connected)
            {
                return;
            }
            MemoryStream ms = new MemoryStream();

            using (PacketOutput output = new PacketOutput(ms))
            {
                output.Write(0);
                output.Write(packet.GetPacketType().ToId());
                packet.Write(output);
            }
            byte[] buffer = ms.ToArray();
            _outgoingEncryption.Cipher(buffer, 5);
            int size = buffer.Length;

            byte[] a = BitConverter.GetBytes(IPAddress.NetworkToHostOrder(size));
            buffer[0] = a[0];
            buffer[1] = a[1];
            buffer[2] = a[2];
            buffer[3] = a[3];
            _socket?.Send(buffer);
        }
コード例 #7
0
ファイル: ServerIp.cs プロジェクト: homiedopie/SharpFly
        public ServerIp(string ipAddress, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.SERVER_IP);

            packet.Write(ipAddress);
            packet.Send(socket);
        }
コード例 #8
0
ファイル: SessionKey.cs プロジェクト: homiedopie/SharpFly
        public SessionKey(int sessionKey, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.SESSION_KEY);

            packet.Write(sessionKey);
            packet.Send(socket);
        }
コード例 #9
0
ファイル: NetworkProcessor.cs プロジェクト: Devwarlt/loe-core
        public void ProcessPacket(OutgoingPacket packet)
        {
            var ms = new MemoryStream();

            using (var wtr = new NetworkWriter(ms))
            {
                packet.Write(wtr);

                var length    = (int)ms.Position;
                var rawBuffer = new byte[length + 1];

                rawBuffer[0] = (byte)packet.PacketID;

                var msBuffer = ms.GetBuffer();

                Array.Resize(ref msBuffer, length);
                Buffer.BlockCopy(msBuffer, 0, rawBuffer, 1, msBuffer.Length);

                OnPacketProcessed.Invoke(rawBuffer);
            }
        }
コード例 #10
0
        public ServerList(List <Cluster> clusters, string accountName, Socket socket)
        {
            OutgoingPacket packet = new OutgoingPacket(OpCodes.SERVER_LIST);

            packet.Write(0);       // authkey
            packet.Write((byte)1); // accountflag
            packet.Write(accountName.ToLower());
            int clusterAndChannelCount = clusters.Count;

            foreach (Cluster cluster in clusters)
            {
                clusterAndChannelCount += cluster.Channels.Count;
            }
            packet.Write(clusterAndChannelCount);
            foreach (Cluster cluster in clusters)
            {
                packet.Write(cluster.ParentId);
                packet.Write(cluster.Id);
                packet.Write(cluster.Name);
                packet.Write(cluster.Ip);
                packet.Write(cluster.Is18Plus);
                packet.Write(cluster.PlayerCount);
                packet.Write(cluster.Enabled);
                packet.Write(cluster.MaxPlayerCount);

                foreach (Channel channel in cluster.Channels)
                {
                    packet.Write(channel.Parent.Id);
                    packet.Write(channel.Id);
                    packet.Write(channel.Name);
                    packet.Write(channel.Ip);
                    packet.Write(channel.Is18Plus);
                    packet.Write(channel.PlayerCount);
                    packet.Write(channel.Enabled);
                    packet.Write(channel.MaxPlayerCount);
                }
            }
            packet.Send(socket);
        }
コード例 #11
0
ファイル: CharacterList.cs プロジェクト: homiedopie/SharpFly
        public CharacterList(uint authKey, Dictionary <CharacterSlot, Character> characters, Socket socket)
        {
            // not finished

            OutgoingPacket packet = new OutgoingPacket(OpCodes.CHARACTER_LIST);

            packet.Write(authKey);               // authkey
            packet.Write(characters.Keys.Count); // character count

            // if > 0 characters
            if (characters.Keys.Count > 0)
            {
                foreach (KeyValuePair <CharacterSlot, Character> character in characters)
                {
                    packet.Write(character.Key.SlotId);
                    packet.Write(2);    // Character block
                    packet.Write(character.Value.Map);
                    packet.Write(0x0B); // Index? 0x0B?
                    packet.Write(character.Value.Name);
                    packet.Write(character.Value.Position.X);
                    packet.Write(character.Value.Position.Y);
                    packet.Write(character.Value.Position.Z);
                    packet.Write(character.Value.CharacterId);
                    packet.Write(0); // ID Party
                    packet.Write(0); // ID Guild
                    packet.Write(0); // ID War
                    packet.Write(character.Value.Skinset);
                    packet.Write(character.Value.HairStyle);
                    packet.Write(character.Value.HairColor);
                    packet.Write(character.Value.HeadMesh);
                    packet.Write(character.Value.Gender);
                    packet.Write(character.Value.ClassId);
                    packet.Write(character.Value.Level);
                    packet.Write(0); // Job level
                    packet.Write(character.Value.Strength);
                    packet.Write(character.Value.Stamina);
                    packet.Write(character.Value.Dexterity);
                    packet.Write(character.Value.Intelligence);
                    packet.Write(0); // Mode
                    packet.Write(0); // equipcount

                    // for each item
                    if (false)
                    {
                        packet.Write(0); // itemid
                    }
                }
            }

            packet.Write(0); // countmessenger
            // for each in countmessenger
            if (false)
            {
                packet.Write(0); // slot? (byte)
            }

            packet.Send(socket);
        }