Beispiel #1
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.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.WriteLong(RequestID);
            p.WriteByte(( byte )Response);

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

            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;
        }
Beispiel #6
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;
 }
Beispiel #7
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;
 }