34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace SharpChat.PacketsS2C {
|
|
public class UserDisconnectLogS2CPacket : SockChatTimedS2CPacket {
|
|
private readonly string UserName;
|
|
private readonly UserDisconnectReason Reason;
|
|
|
|
public UserDisconnectLogS2CPacket(
|
|
long messageId,
|
|
DateTimeOffset timeStamp,
|
|
string userName,
|
|
UserDisconnectReason reason
|
|
) : base(messageId, timeStamp) {
|
|
UserName = userName;
|
|
Reason = reason;
|
|
}
|
|
|
|
public override string Pack() {
|
|
return string.Format(
|
|
"7\t1\t{0}\t-1\tChatBot\tinherit\t\t0\f{1}\f{2}\t{3}\t0\t10010",
|
|
TimeStamp.ToUnixTimeSeconds(),
|
|
Reason switch {
|
|
UserDisconnectReason.Leave => "leave",
|
|
UserDisconnectReason.TimeOut => "timeout",
|
|
UserDisconnectReason.Kicked => "kick",
|
|
UserDisconnectReason.Flood => "flood",
|
|
_ => "leave",
|
|
},
|
|
UserName,
|
|
MessageId
|
|
);
|
|
}
|
|
}
|
|
}
|