GithubHelp home page GithubHelp logo

daivuk / archipelago.multiclient.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from archipelagomw/archipelago.multiclient.net

0.0 1.0 1.0 3.93 MB

A client library for use with .NET based prog-langs for interfacing with Archipelago hosts.

License: MIT License

C# 99.31% PowerShell 0.69% Batchfile 0.01%

archipelago.multiclient.net's Introduction

Archipelago.MultiClient.Net

A client library for use with .NET based prog-langs for interfacing with Archipelago hosts.

Getting Started

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));
session.Locations.CompleteLocationChecks(42);

The ArchipelagoSession object is your entrypoint for all operations with the server. The session object exposes various helpers which provide functionality for various objectives you might be trying to achieve.

LocationCheckHelper

The location check helper may be used to complete or scout location checks. The API also provides utility functions such as retrieving the name of a location from numerical id.

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));
session.Locations.CompleteLocationChecks(42);

string locationName = session.Locations.GetLocationNameFromId(42);
int locationId = session.Locations.GetLocationIdFromName(locationName);

session.Locations.ScoutLocationsAsync(locationInfoPacket => Console.WriteLine(locationInfoPacket.Locations.Count));

ReceivedItemsHelper

The received items helper provides an interface for retrieving the list of received items as well as a C# event for when an item is received. The event automatically executes its registered event handlers when an item is received. A utility method is also included for getting an item name from numerical id.

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));
session.Items.ItemReceived += (receivedItemsHelper) => {
	var itemReceivedName = receivedItemsHelper.PeekItemName();
	// ... Handle item receipt.

	receivedItemsHelper.DequeueItem();
};

PlayerHelper

The player helper provides methods for accessing details about the other players currently connected to the Archipelago session.

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));
var sortedPlayerNames = session.Players.AllPlayers.Select(x => x.Name).OrderBy(x => x);

ArchipelagoSocketHelper

The socket helper is a lower level API allowing for direct access to the socket which the session object uses to communicate with the Archipelago server. You may use this object to hook onto when messages are received or you may use it to send any packets defined in the library. Various events are exposed to allow for receipt of errors or notifying of socket close.

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));
session.Socket.SendPacket(new SayPacket(){Text = "Woof woof!"});

DeathLink

DeathLink support is included in the library. You may enable it by using the CreateDeathLinkServiceAndEnable in the DeathLinkProvider class. This method is also an extension method so you may enable it more easily. DeathLink should be enabled before the socket connection is opened.

var session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

var deathLinkService = session.CreateDeathLinkServiceAndEnable();
session.TryConnectAndLogin("Risk of Rain 2", "Ijwu", new Version(2,1,0));

deathLinkService.OnDeathLinkReceived += (deathLinkObject) => {
	// ... Kill your player(s).
};

// ... On death:
deathLinkService.SendDeathLink(new DeathLink(){
	sourcePlayer = "Ijwu",
	cause = "Died to exposure."
});

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.