30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
|
using Tiger.Communication.Messages.Interfaces;
|
||
|
using Tiger.Communication.Messages.Outgoing.Notifications;
|
||
|
using Tiger.Communication.Messages.Outgoing.Users;
|
||
|
using Tiger.Communication.Messages.Types;
|
||
|
using Tiger.Networking.Game.Sessions;
|
||
|
|
||
|
namespace Tiger.Communication.Messages.Incoming.Inventory.Purse;
|
||
|
|
||
|
public class GetCreditsInfoEvent : IMessageEvent
|
||
|
{
|
||
|
private readonly IGameSessionManager _gameSessionManager;
|
||
|
|
||
|
public GetCreditsInfoEvent(IGameSessionManager gameSessionManager)
|
||
|
{
|
||
|
_gameSessionManager = gameSessionManager;
|
||
|
}
|
||
|
|
||
|
public IncomingHeaders Header => IncomingHeaders.GetCreditsInfoEvent;
|
||
|
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
||
|
{
|
||
|
if (gameSession.Habbo == null)
|
||
|
{
|
||
|
await _gameSessionManager.CloseAsync("Not logged in", gameSession);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
await gameSession.SendComposerAsync(new CreditBalanceComposer(gameSession.Habbo.Credits));
|
||
|
await gameSession.SendComposerAsync(new ActivityPointsComposer(gameSession.Habbo.Activitypoints ?? null));
|
||
|
}
|
||
|
}
|