Provides convenient work with network events Albion Online.
- Refusal to support the list of events and operations.
- Asynchronous event and operation handlers.
!WARNING! No supports backward compatibility with version 4.7.0!
Brimstone & Mist
- Updating event codes
Migrating from PcapDotNet to SharpPcap. Change the target platforms .NET 4.7.1 on the .NET Standart 2.0 and .NET Core 3.1. Windows and Linux support.
STAR if you liked it, thank you!
You should install Albion Network with NuGet:
Install-Package Albion.Network
Read more here sharppcap
In this example, we enable the processing of the message "Operation.Move".
using Albion.Common;
using Albion.Operation;
using Albion.Network;
ReceiverBuilder builder = ReceiverBuilder.Create();
builder.AddRequestHandler(new MoveRequestHandler());
IPhotonReceiver receiver = builder.Build();
using System;
namespace Albion.Network.Example
{
public class MoveRequestHandler : RequestPacketHandler<MoveOperation>
{
public MoveRequestHandler() : base(OperationCodes.Move) { }
protected override void OnAction(MoveOperation value)
{
Console.WriteLine($"Move request");
}
}
}
To capture network packets we need Sharppcap.
using PacketDotNet;
using SharpPcap;
using System;
using System.Threading;
private IPhotonReceiver receiver;
...
private void PacketHandler(object sender, CaptureEventArgs e)
{
UdpPacket packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract<UdpPacket>();
if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056))
{
receiver.ReceivePacket(packet.PayloadData);
}
}
A full example can be found here Example
Feedback Discord DocTi#1410