34 lines
1.5 KiB
C#
34 lines
1.5 KiB
C#
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;
|
|
}
|
|
|
|
public OutgoingHeaders Header => OutgoingHeaders.AchievementNotification;
|
|
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);
|
|
}
|
|
} |