server-master/srcs/_plugins/WingsEmu.Plugins.BasicImplementation/NpcDialogs/OpenNosBazaarHandler.cs
2026-02-10 18:21:30 +01:00

31 lines
No EOL
933 B
C#

using System.Threading.Tasks;
using WingsEmu.DTOs.Maps;
using WingsEmu.Game._NpcDialog;
using WingsEmu.Game._NpcDialog.Event;
using WingsEmu.Game.Bazaar.Events;
using WingsEmu.Game.Entities;
using WingsEmu.Game.Networking;
using WingsEmu.Packets.Enums;
namespace WingsEmu.Plugins.BasicImplementations.NpcDialogs;
public class OpenNosBazaarHandler : INpcDialogAsyncHandler
{
public NpcRunType[] NpcRunTypes => new[] { NpcRunType.OPEN_NOSBAZAAR };
public async Task Execute(IClientSession session, NpcDialogEvent e)
{
INpcEntity npcEntity = session.CurrentMapInstance.GetNpcById(e.NpcId);
if (npcEntity == null)
{
return;
}
if (!session.CurrentMapInstance.HasMapFlag(MapFlags.IS_BASE_MAP) && !session.CurrentMapInstance.HasMapFlag(MapFlags.ACT_4))
{
return;
}
await session.EmitEventAsync(new BazaarOpenUiEvent(false));
}
}