/// <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; }
/// <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> /// 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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }