sharp-chat/SharpChat/S2CPackets/UserChannelJoinS2CPacket.cs
flashwave 9f283e48fe
Removed external pack methods.
These do need to be reimploded at some point probably, but this at least gets them out of common code.
2025-04-25 21:22:25 +00:00

37 lines
1.2 KiB
C#

using System.Text;
namespace SharpChat.S2CPackets {
public class UserChannelJoinS2CPacket(
long msgId,
long userId,
string userName,
ChatColour userColour,
int userRank,
ChatUserPermissions userPerms
) : S2CPacket {
public string Pack() {
StringBuilder sb = new();
sb.Append("5\t0\t");
sb.Append(userId);
sb.Append('\t');
sb.Append(userName);
sb.Append('\t');
sb.Append(userColour);
sb.Append('\t');
sb.Append(userRank);
sb.Append(' ');
sb.Append(userPerms.HasFlag(ChatUserPermissions.KickUser) ? '1' : '0');
sb.Append(' ');
sb.Append(userPerms.HasFlag(ChatUserPermissions.ViewLogs) ? '1' : '0');
sb.Append(' ');
sb.Append(userPerms.HasFlag(ChatUserPermissions.SetOwnNickname) ? '1' : '0');
sb.Append(' ');
sb.Append(userPerms.HasFlag(ChatUserPermissions.CreateChannel) ? (userPerms.HasFlag(ChatUserPermissions.SetChannelPermanent) ? '2' : '1') : '0');
sb.Append('\t');
sb.Append(msgId);
return sb.ToString();
}
}
}