34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.Globalization;
|
|
using Tiger.Communication.Messages.Interfaces;
|
|
using Tiger.Communication.Messages.Types;
|
|
using Tiger.Game.Habbos;
|
|
|
|
namespace Tiger.Communication.Messages.Outgoing.User.Data;
|
|
|
|
public class UserProfileComposer : IMessageComposer
|
|
{
|
|
private readonly Habbo _habbo;
|
|
|
|
public UserProfileComposer(Habbo habbo)
|
|
{
|
|
_habbo = habbo;
|
|
}
|
|
|
|
public OutgoingHeaders Header => OutgoingHeaders.UserProfile;
|
|
public void Compose(ServerMessage message)
|
|
{
|
|
message.AppendInt32(_habbo.Id);
|
|
message.AppendString(_habbo.Username);
|
|
message.AppendString(_habbo.Figure);
|
|
message.AppendString(_habbo.Motto);
|
|
message.AppendString(_habbo.AccountCreated.ToString(CultureInfo.CurrentCulture));
|
|
message.AppendInt32(_habbo.AchievementScore);
|
|
message.AppendInt32(0); // friend count
|
|
message.AppendBoolean(false); // is friend
|
|
message.AppendBoolean(false); // friend request sent
|
|
message.AppendBoolean(_habbo.Online);
|
|
message.AppendInt32(0); // groups
|
|
message.AppendInt32((int)(_habbo.LastLogin == null ? 0 : (DateTime.Now - _habbo.LastLogin.Value).TotalSeconds));
|
|
message.AppendBoolean(true); // open but why would it not open?
|
|
}
|
|
} |