45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using Tiger.Communication.Messages.Interfaces;
|
|
using Tiger.Communication.Messages.Types;
|
|
using Tiger.Game.Catalogue;
|
|
using Tiger.Game.Habbos;
|
|
|
|
namespace Tiger.Communication.Messages.Outgoing.Catalog;
|
|
|
|
public class HabboClubOffersMessageComposer : IMessageComposer
|
|
{
|
|
private readonly ICollection<ClubOffer> _clubOffers;
|
|
private readonly HabboSubscription? _habboSubscription;
|
|
|
|
public HabboClubOffersMessageComposer(ICollection<ClubOffer> clubOffers, HabboSubscription? habboSubscription)
|
|
{
|
|
_clubOffers = clubOffers;
|
|
_habboSubscription = habboSubscription;
|
|
}
|
|
|
|
public OutgoingHeaders Header => OutgoingHeaders.ClubOffers;
|
|
public void Compose(ServerMessage message)
|
|
{
|
|
message.AppendInt32(_clubOffers.Count);
|
|
|
|
foreach (var clubOffer in _clubOffers)
|
|
{
|
|
var end = _habboSubscription is not null
|
|
? _habboSubscription.Expires.AddDays(clubOffer.Days)
|
|
: DateTime.Now.AddMonths(1);
|
|
message.AppendInt32(clubOffer.Id);
|
|
message.AppendString(clubOffer.Name);
|
|
message.AppendBoolean(false); // does absolutely NOTHING
|
|
message.AppendInt32(clubOffer.PriceCredits);
|
|
message.AppendInt32(clubOffer.PriceActivitypoints);
|
|
message.AppendInt32(clubOffer.ActivitypointsType);
|
|
message.AppendBoolean(true); // always vip
|
|
message.AppendInt32(0); // months
|
|
message.AppendInt32(clubOffer.Days); // extra days
|
|
message.AppendBoolean(true); // gift-able
|
|
message.AppendInt32(0); // days left after purchase
|
|
message.AppendInt32(end.Year);
|
|
message.AppendInt32(end.Month);
|
|
message.AppendInt32(end.Day);
|
|
}
|
|
}
|
|
} |