2024-05-20 23:00:47 +00:00
|
|
|
|
namespace SharpChat.PacketsS2C {
|
|
|
|
|
public class UserConnectS2CPacket : SockChatTimedS2CPacket {
|
2024-05-10 18:29:48 +00:00
|
|
|
|
private readonly long UserId;
|
|
|
|
|
private readonly string UserName;
|
2024-05-19 02:17:51 +00:00
|
|
|
|
private readonly Colour UserColour;
|
2024-05-10 18:29:48 +00:00
|
|
|
|
private readonly int UserRank;
|
2024-05-19 02:17:51 +00:00
|
|
|
|
private readonly UserPermissions UserPerms;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
2024-05-20 23:00:47 +00:00
|
|
|
|
public UserConnectS2CPacket(
|
2024-05-10 18:29:48 +00:00
|
|
|
|
long userId,
|
|
|
|
|
string userName,
|
2024-05-19 02:17:51 +00:00
|
|
|
|
Colour userColour,
|
2024-05-10 18:29:48 +00:00
|
|
|
|
int userRank,
|
2024-05-19 02:17:51 +00:00
|
|
|
|
UserPermissions userPerms
|
2024-05-10 18:29:48 +00:00
|
|
|
|
) {
|
|
|
|
|
UserId = userId;
|
2024-05-14 22:56:56 +00:00
|
|
|
|
UserName = userName;
|
2024-05-10 18:29:48 +00:00
|
|
|
|
UserColour = userColour;
|
|
|
|
|
UserRank = userRank;
|
|
|
|
|
UserPerms = userPerms;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 15:24:43 +00:00
|
|
|
|
public override string Pack() {
|
2024-05-10 17:28:52 +00:00
|
|
|
|
return string.Format(
|
|
|
|
|
"1\t{0}\t{1}\t{2}\t{3}\t{4} {5} {6} {7} {8}\t{9}",
|
2024-05-20 02:16:38 +00:00
|
|
|
|
TimeStamp.ToUnixTimeSeconds(),
|
2024-05-10 18:29:48 +00:00
|
|
|
|
UserId,
|
|
|
|
|
UserName,
|
|
|
|
|
UserColour,
|
|
|
|
|
UserRank,
|
2024-05-19 02:17:51 +00:00
|
|
|
|
UserPerms.HasFlag(UserPermissions.KickUser) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(UserPermissions.ViewLogs) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(UserPermissions.SetOwnNickname) ? 1 : 0,
|
|
|
|
|
UserPerms.HasFlag(UserPermissions.CreateChannel) ? (
|
|
|
|
|
UserPerms.HasFlag(UserPermissions.SetChannelPermanent) ? 2 : 1
|
2024-05-10 18:29:48 +00:00
|
|
|
|
) : 0,
|
2024-05-20 02:16:38 +00:00
|
|
|
|
MessageId
|
2024-05-10 17:28:52 +00:00
|
|
|
|
);
|
2022-08-30 15:00:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|