2023-10-07 13:32:19 +00:00
|
|
|
using Tiger.Communication.Messages.Interfaces;
|
|
|
|
using Tiger.Communication.Messages.Types;
|
|
|
|
using Tiger.Game.Habbos;
|
|
|
|
|
|
|
|
namespace Tiger.Communication.Messages.Outgoing.Notifications;
|
|
|
|
|
|
|
|
public class AchievementNotificationMessageComposer : IMessageComposer
|
|
|
|
{
|
|
|
|
private readonly HabboAchievement _habboAchievement;
|
|
|
|
private readonly int _badgeId;
|
|
|
|
|
|
|
|
public AchievementNotificationMessageComposer(HabboAchievement habboAchievement, int badgeId)
|
|
|
|
{
|
|
|
|
_habboAchievement = habboAchievement;
|
|
|
|
_badgeId = badgeId;
|
|
|
|
}
|
|
|
|
|
2023-10-14 16:21:53 +00:00
|
|
|
public OutgoingHeaders Header => OutgoingHeaders.AchievementNotification;
|
2023-10-07 13:32:19 +00:00
|
|
|
public void Compose(ServerMessage message)
|
|
|
|
{
|
|
|
|
message.AppendInt32(_habboAchievement.Achievement.Id);
|
|
|
|
message.AppendInt32(_habboAchievement.Level);
|
|
|
|
message.AppendInt32(_badgeId);
|
|
|
|
message.AppendString($"{_habboAchievement.Achievement.Badge}{_habboAchievement.Level}");
|
|
|
|
message.AppendInt32(0); // points?
|
|
|
|
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].RewardAmount);
|
|
|
|
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].RewardType);
|
|
|
|
message.AppendInt32(_habboAchievement.Achievement.Levels[_habboAchievement.Level].Points);
|
|
|
|
message.AppendInt32(_habboAchievement.Achievement.Id);
|
|
|
|
message.AppendString(_habboAchievement.Level > 1 ? $"{_habboAchievement.Achievement.Badge}{_habboAchievement.Level - 1}" : string.Empty);
|
|
|
|
message.AppendString(_habboAchievement.Achievement.Category);
|
|
|
|
message.AppendBoolean(true);
|
|
|
|
}
|
|
|
|
}
|