Skip to content

Chat Links

Ruhrpottpatriot edited this page Sep 1, 2015 · 2 revisions

Introduction

GW2.NET can convert chat links between text and managed CLR objects. Each known chat link type has its own class and corresponding converter.

How to

The conversion system is the same for each chat link type. You can access converters via a static property named ChatLink.Factory.

Generating an item chat link

int tribalBowId = 38875;

// Convert the item identifier to an object of type ChatLink
ChatLink chatLink = ChatLink.Factory.EncodeItem(itemId: tribalBowId, quantity: 1);

// The ChatLink overrides ToString() for converting chat links to base64-encoded text
Console.WriteLine(chatLink);

Decoding an item chat link

// The ChatLinkFactory class can also convert base64-encoded text to ChatLink objects
ItemChatLink chatLink = ChatLink.Factory.Decode("[&AgHblwAA]") as ItemChatLink;

// Write to console, but of course you can use it wherever you want.
Console.WriteLine(chatLink.ItemId);