/// <summary>
 /// Converts current struct to it's <see cref="Packet"/> equivalent.
 /// </summary>
 /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
 public Packet ToPacket()
 {
     Packet p = new OPPacket(Opcodes);
     p.WriteLong(RequestID);
     p.WriteByte(Response);
     return p;
 }
 /// <summary>
 /// Converts current struct to it's <see cref="Packet"/> equivalent.
 /// </summary>
 /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
 public Packet ToPacket()
 {
     Packet p = new OPPacket(Opcodes);
     p.WriteLong(RequestID);
     p.WriteInt(SessionID);
     p.WriteByte(WorldID);
     return p;
 }
        /// <summary>
        /// Converts current struct to it's <see cref="Packet"/> equivalent.
        /// </summary>
        /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
        public Packet ToPacket()
        {
            Packet p = new OPPacket(Opcodes);

            p.WriteByte
                (
                    ServiceId,
                    ServiceType
                );

            return p;
        }
Beispiel #4
0
        /// <summary>
        /// Worlds data server > client packet.
        /// </summary>
        /// <param name="lastWorld">Last world user was played in.</param>
        /// <param name="summary">Worlds summary.</param>
        /// <returns>Worlds summary <see cref="Packet"/></returns>
        internal static Packet ToPacket( byte lastWorld, WorldSummary[] summary )
        {
            Packet p = new OPPacket(Opcode);

            p.WriteByte
                (
                    ( byte )summary.Length,
                    lastWorld
                );

            int bits;

            foreach ( WorldSummary ws in summary )
            {
                bits = 0x00;

                if ( ws.IsTestServer )
                    bits |= 0x04;
                if ( ws.ShowClock )
                    bits |= 0x02;

                p.WriteByte(ws.ID);
                p.WriteByte(127);  // temp hack
                p.WriteByte(0);
                p.WriteByte(0);
                p.WriteByte(1);
                //p.WriteBytesArray(ws.Address);
                p.WriteInt(ws.Port);

                p.WriteByte
                    (
                        ws.AgeLimit,
                        ( ws.IsPvP ? ( byte )0x01 : ( byte )0x00 )
                    );

                p.WriteShort
                    (
                        ws.UsersOnline,
                        ws.UsersMax
                    );

                p.WriteByte(ws.IsOnline ? ( byte )0x01 : ( byte )0x00);
                p.WriteInt(bits);

                p.WriteInt(ws.ShowBrackets ? ( byte )0x01 : ( byte )0x00);
            }

            return p;
        }
        /// <summary>
        /// Converts current struct to it's <see cref="Packet"/> equivalent.
        /// </summary>
        /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
        public Packet ToPacket()
        {
            Packet p = new OPPacket(Opcodes);

            p.WriteByte
                (
                    RemoteServiceID,
                    RemoteServiceType,
                    Answer
                );

            return p;
        }
        /// <summary>
        /// Converts current struct to it's <see cref="Packet"/> equivalent.
        /// </summary>
        /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
        public Packet ToPacket()
        {
            Packet p = new OPPacket(Opcodes);

            p.WriteLong(RequestID);
            p.WriteByte(( byte )Response);

            switch ( Response )
            {
                case UserAuthenticationResponseType.UserAccepted:
                    {
                        p.WriteInt(UserID);
                        p.WriteByte
                            (
                                LastWorldID,
                                AccessLevel
                            );
                        break;
                    }
                default:
                    break;
            }

            return p;
        }
Beispiel #7
0
 /// <summary>
 /// Play failed server > client packet.
 /// </summary>
 /// <param name="reason">Play failed reason.</param>
 /// <returns>Play failed <see cref="Packet"/>.</returns>
 internal static Packet ToPacket( JoinWorldRequestResult reason )
 {
     Packet p = new OPPacket(Opcode);
     p.WriteByte(( byte )reason);
     return p;
 }
Beispiel #8
0
 /// <summary>
 /// Login failed server > client packet.
 /// </summary>
 /// <param name="response">Login failed reason.</param>
 /// <returns>Login failed <see cref="Packet"/>.</returns>
 internal static Packet ToPacket( UserAuthenticationResponseType response )
 {
     Packet p = new OPPacket(Opcode);
     p.WriteByte(( byte )response);
     return p;
 }
 /// <summary>
 /// Converts current struct to it's <see cref="Packet"/> equivalent.
 /// </summary>
 /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
 public Packet ToPacket()
 {
     Packet p = new OPPacket(Opcodes);
     p.WriteLong(RequestID);
     p.WriteByte(( byte )Result);
     return p;
 }