TigerEmu/Communication/Messages/Outgoing/Notifications/ActivityPointsComposer.cs

29 lines
880 B
C#
Raw Normal View History

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
using Tiger.Game.Habbos;
namespace Tiger.Communication.Messages.Outgoing.Notifications;
public class ActivityPointsComposer : IMessageComposer
{
private readonly IEnumerable<Activitypoints>? _activitypoints;
public ActivityPointsComposer(IEnumerable<Activitypoints>? activitypoints)
{
_activitypoints = activitypoints;
}
public OutgoingHeaders Header => OutgoingHeaders.ActivityPointsMessageComposer;
public void Compose(ServerMessage message)
{
message.AppendInt32(_activitypoints?.Count() ?? 0);
if (_activitypoints == null) return;
foreach (var activitypoint in _activitypoints)
{
message.AppendInt32(activitypoint.Type);
message.AppendInt32(activitypoint.Amount);
}
}
}