server-master/srcs/_plugins/WingsEmu.Plugins.GameEvents/Consumers/SpecialistPointsRefreshMessageConsumer.cs
2026-02-10 18:21:30 +01:00

31 lines
No EOL
1 KiB
C#

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using PhoenixLib.ServiceBus;
using WingsAPI.Communication.Player;
using WingsEmu.Game.Characters.Events;
using WingsEmu.Game.Managers;
using WingsEmu.Game.Networking;
namespace WingsEmu.Plugins.GameEvents.Consumers
{
public class SpecialistPointsRefreshMessageConsumer : IMessageConsumer<SpecialistPointsRefreshMessage>
{
private readonly ISessionManager _sessionManager;
public SpecialistPointsRefreshMessageConsumer(ISessionManager sessionManager) => _sessionManager = sessionManager;
public async Task HandleAsync(SpecialistPointsRefreshMessage notification, CancellationToken token)
{
IReadOnlyList<IClientSession> sessions = _sessionManager.Sessions;
foreach (IClientSession session in sessions)
{
await session.EmitEventAsync(new SpecialistRefreshEvent
{
Force = notification.Force
});
}
}
}
}