server-master/srcs/_plugins/WingsEmu.Plugins.PacketHandling/Game/ScriptedInstance/EscapePacketHandler.cs
2026-02-10 18:21:30 +01:00

34 lines
No EOL
1.2 KiB
C#

using System.Threading.Tasks;
using WingsEmu.Game.Maps;
using WingsEmu.Game.Networking;
using WingsEmu.Game.Raids.Events;
using WingsEmu.Game.RainbowBattle.Event;
using WingsEmu.Game.TimeSpaces.Events;
using WingsEmu.Packets.ClientPackets;
namespace WingsEmu.Plugins.PacketHandling.Game.ScriptedInstance;
public class EscapePacketHandler : GenericGamePacketHandlerBase<EscapePacket>
{
protected override async Task HandlePacketAsync(IClientSession session, EscapePacket packet)
{
switch (session.CurrentMapInstance.MapInstanceType)
{
case MapInstanceType.RainbowBattle:
await session.EmitEventAsync(new RainbowBattleLeaveEvent
{
CheckIfFinished = true
});
break;
case MapInstanceType.RaidInstance:
await session.EmitEventAsync(new RaidPartyLeaveEvent(false));
break;
case MapInstanceType.TimeSpaceInstance:
await session.EmitEventAsync(new TimeSpaceLeavePartyEvent
{
CheckFinished = true
});
break;
}
}
}