Giter Site home page Giter Site logo

albion-network's Introduction

Albion Network

Provides convenient work with network events Albion Online.

v5.0.0

  • Refusal to support the list of events and operations.
  • Asynchronous event and operation handlers.

!WARNING! No supports backward compatibility with version 4.7.0!

v4.7.0

Brimstone & Mist

  • Updating event codes

v4.6.0

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!

Installing

You should install Albion Network with NuGet:

Install-Package Albion.Network

Dependencies

  • On Windows, Npcap (formerly WinPcap) extensions
  • On Linux, libpcap

Read more here sharppcap

Example

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

albion-network's People

Contributors

docti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.