/// <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;
 }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
        /// <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;
        }
Ejemplo n.º 4
0
        /// <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;
        }
Ejemplo n.º 5
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.WriteLong(RequestID);

            p.WriteString
                (
                    Login,
                    Password
                );

            p.WriteInt(SessionID);

            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.WriteString(Session.AccountName);
            p.WriteString(Session.IPAddress);

            p.WriteInt
                (
                    Session.ID,
                    Session.AccountID,
                    Session.Login1,
                    Session.Login2,
                    Session.Play1,
                    Session.Play2
                );

            p.InternalWriteDateTime(Session.StartTime);

            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;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates <see cref="Packet"/> that contains provided <see cref="RemoteServiceSettings"/> data.
 /// </summary>
 /// <param name="settings"><see cref="RemoteServiceSettings"/> to create <see cref="Packet"/> from.</param>
 /// <returns><see cref="Packet"/> that contains provided <see cref="RemoteServiceSettings"/> data.</returns>
 public Packet ToPacket( RemoteServiceSettings settings )
 {
     Packet p = new OPPacket(Opcodes);
     settings.Write(ref p);
     return p;
 }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Login accepted server > client packet.
 /// </summary>
 /// <param name="session"><see cref="UserSession"/> object.</param>
 /// <returns>Login accepted <see cref="Packet"/>.</returns>
 internal static Packet ToPacket( UserSession session )
 {
     Packet p = new OPPacket(Opcode);
     p.WriteInt(session.Login1, session.Login2);
     return p;
 }
Ejemplo n.º 12
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;
 }
Ejemplo n.º 13
0
 /// <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;
 }
Ejemplo n.º 14
0
 /// <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.WriteInt(SessionID);
     return p;
 }