28 lines
918 B
C#
28 lines
918 B
C#
|
using Tiger.Communication.Messages.Interfaces;
|
||
|
using Tiger.Communication.Messages.Outgoing.Inventory.Badges;
|
||
|
using Tiger.Communication.Messages.Types;
|
||
|
using Tiger.Networking.Game.Sessions;
|
||
|
|
||
|
namespace Tiger.Communication.Messages.Incoming.Inventory.Badges;
|
||
|
|
||
|
public class RequestBadgesEvent : IMessageEvent
|
||
|
{
|
||
|
private readonly IGameSessionManager _gameSessionManager;
|
||
|
|
||
|
public RequestBadgesEvent(IGameSessionManager gameSessionManager)
|
||
|
{
|
||
|
_gameSessionManager = gameSessionManager;
|
||
|
}
|
||
|
|
||
|
public IncomingHeaders Header => IncomingHeaders.UserBadges;
|
||
|
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||
|
{
|
||
|
if (gameSession.Habbo == null)
|
||
|
{
|
||
|
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
await gameSession.SendComposerAsync(new BadgesComposer(gameSession.Habbo.Badges));
|
||
|
}
|
||
|
}
|