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

39 lines
No EOL
946 B
C#

using System.Threading.Tasks;
using WingsEmu.Game._Guri;
using WingsEmu.Game._Guri.Event;
using WingsEmu.Game.Characters.Events;
using WingsEmu.Game.Inventory;
using WingsEmu.Game.Networking;
using WingsEmu.Packets.Enums;
namespace WingsEmu.Plugins.BasicImplementations.Guri;
public class RollGeneratedItemGuriHandler : IGuriHandler
{
public long GuriEffectId => 4999;
public async Task ExecuteAsync(IClientSession session, GuriEvent guriPacket)
{
if (guriPacket.Data != 8023)
{
return;
}
if (guriPacket.User == null)
{
return;
}
short slot = (short)guriPacket.User.Value;
InventoryItem box = session.PlayerEntity.GetItemBySlotAndType(slot, InventoryType.Main);
if (box == null)
{
return;
}
await session.EmitEventAsync(new RollItemBoxEvent
{
Item = box
});
}
}