//
// SayResponder.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosCore.Packets.Enumerations;
using NosCore.Packets.ServerPackets.Chats;
using NosCore.Packets.ServerPackets.UI;
using NosCore.Shared.Enumerations;
using NosSmooth.Core.Client;
using NosSmooth.Core.Packets;
using Remora.Results;
namespace SimpleChat;
///
/// Responds to .
///
public class SayResponder : IPacketResponder, IPacketResponder
{
private readonly INostaleClient _client;
///
/// Initializes a new instance of the class.
///
/// The nostale client.
public SayResponder(INostaleClient client)
{
_client = client;
}
///
public Task Respond(PacketEventArgs packet, CancellationToken ct = default)
{
return _client.ReceivePacketAsync(
new SayPacket()
{
Message = "Hello world from NosSmooth!", VisualType = VisualType.Player, Type = SayColorType.Red, VisualId = 1,
},
ct);
}
///
public Task Respond(PacketEventArgs packet, CancellationToken ct = default)
{
return _client.ReceivePacketAsync(
new SayPacket()
{
Message = "Hello world from NosSmooth!",
VisualType = VisualType.Player,
Type = SayColorType.Red,
VisualId = 1,
},
ct);
}
}