Chat Links

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.

Example: 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);

Example: 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);

Last edited Mar 7, 2015 at 7:41 PM by StevenLiekens, version 3