TigerEmu/Communication/Messages/Outgoing/Inventory/Subscription/UserSubscriptionComposer.cs

32 lines
1.4 KiB
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
using Tiger.Game.Habbos;
namespace Tiger.Communication.Messages.Outgoing.Inventory.Subscription;
public class UserSubscriptionComposer : IMessageComposer
{
private readonly HabboSubscription? _habboSubscription;
private readonly int _pastSubscriptionDays;
public UserSubscriptionComposer(HabboSubscription? habboSubscription, int pastSubscriptionDays)
{
_habboSubscription = habboSubscription;
_pastSubscriptionDays = pastSubscriptionDays;
}
public OutgoingHeaders Header => OutgoingHeaders.UserSubscription;
public void Compose(ServerMessage message)
{
message.AppendString(_habboSubscription?.SubscriptionType ?? string.Empty);
message.AppendInt32(_habboSubscription?.DaysInMonthLeft ?? 0);
message.AppendInt32(_habboSubscription?.MonthsLeft ?? 0);
message.AppendInt32(0); // periods subscribed ahead but why is this different than above?
message.AppendInt32(0); // response type
message.AppendBoolean(_pastSubscriptionDays > 0);
message.AppendBoolean(true); // vip but always vip?
message.AppendInt32(0); // past club days but is always vip so below is used
message.AppendInt32(_pastSubscriptionDays);
message.AppendInt32((int)(_habboSubscription?.MinutesLeft ?? 0));
}
}